Template:Fragoria Map
From FragoriaWiki
(Difference between revisions)
Line 66: | Line 66: | ||
}); | }); | ||
+ | setMarkers (map, dungeons); | ||
+ | |||
var FragotownMarker = new google.maps.Marker({ | var FragotownMarker = new google.maps.Marker({ | ||
position: new google.maps.LatLng(-89.623848,33.001326), | position: new google.maps.LatLng(-89.623848,33.001326), | ||
Line 74: | Line 76: | ||
}); | }); | ||
- | + | /* var DarkKonungMarker = new google.maps.Marker({ | |
position: new google.maps.LatLng(-89.128166,16.829451), | position: new google.maps.LatLng(-89.128166,16.829451), | ||
map: map, | map: map, | ||
Line 172: | Line 174: | ||
title:"Prison of Ancient Gods" | title:"Prison of Ancient Gods" | ||
}); | }); | ||
- | + | */ | |
+ | |||
//Report Coordinates | //Report Coordinates | ||
google.maps.event.addListener(FragotownMarker, 'dragend', function(evt){ | google.maps.event.addListener(FragotownMarker, 'dragend', function(evt){ | ||
Line 187: | Line 190: | ||
var y = coord.y; | var y = coord.y; | ||
var x = coord.x; | var x = coord.x; | ||
- | |||
// tile range in one direction range is dependent on zoom level | // tile range in one direction range is dependent on zoom level | ||
// 0 = 1 tile, 1 = 2 tiles, 2 = 4 tiles, 3 = 8 tiles, etc | // 0 = 1 tile, 1 = 2 tiles, 2 = 4 tiles, 3 = 8 tiles, etc | ||
var tileRange = 2 << zoom; | var tileRange = 2 << zoom; | ||
- | |||
// repeat across y-axis (vertically) | // repeat across y-axis (vertically) | ||
if (y < 0 || y >= tileRange) { | if (y < 0 || y >= tileRange) { | ||
Line 197: | Line 198: | ||
return null; | return null; | ||
} | } | ||
- | |||
// repeat across x-axis | // repeat across x-axis | ||
if (x < 0 || x >= tileRange) { | if (x < 0 || x >= tileRange) { | ||
x = (x % tileRange + tileRange) % tileRange; | x = (x % tileRange + tileRange) % tileRange; | ||
// return null; | // return null; | ||
- | } | + | } |
- | + | ||
return { | return { | ||
x: x, | x: x, | ||
Line 209: | Line 208: | ||
}; | }; | ||
+ | } | ||
+ | |||
+ | var dungeons = [ | ||
+ | ['Dark Konung's Tomb',-89.128166,16.829451,2], | ||
+ | ['Robber's Vault',-89.089905,47.766951,3], | ||
+ | ['Savage Dens',-89.221718,29.309920,4], | ||
+ | ['Wolf's Lair',-89.931470,45.657576,5], | ||
+ | ['Castle Pantry',-89.870076,-49.527971,6], | ||
+ | ['Poisoned Spring',-89.848769,-88.551408,7], | ||
+ | ['Robber's Camp',-88.900931,-51.901018,8], | ||
+ | ['Underwater Temple / Grandmother's Cave',-87.884290,-87.760393,9], | ||
+ | ['Yard of the Red Witch',-82.335838,-100.152971,10], | ||
+ | ['Abandoned Bonekeep',-62.927026,-64.293596,11], | ||
+ | ['White Worm's Lair',24.423564,-113.072893,12], | ||
+ | ['Winter Castle',32.450837,-79.059221,13], | ||
+ | ['Gates of Night',65.319363,-104.108049,14], | ||
+ | ['Prison of the Ancient Gods',67.329878,-103.844377,15], | ||
+ | ]; | ||
+ | |||
+ | function setMarkers(map, locations) { | ||
+ | var image = { | ||
+ | url: '/wiki/images/c/c3/Greendungeon.png', | ||
+ | size: new google.maps.Size(21, 20), // Marker size (pixel width, pixel length) | ||
+ | origin: new google.maps.Point(10.5,10), // Image origin | ||
+ | anchor: new google.maps.Point(10.5, 10) // Point affixed onto map. | ||
+ | }; | ||
+ | var shape = { | ||
+ | coords: [0, 0, 0, 20, 21, 20 , 20, 0], // Clickable region of map. Increases X to the right and Y down. | ||
+ | type: 'poly' | ||
+ | }; | ||
+ | for (var i = 0; i < locations.length; i++) { | ||
+ | var dungeon = locations[i]; | ||
+ | var myLatLng = new google.maps.LatLng(dungeon[1], dungeon[2]); | ||
+ | var marker = new google.maps.Marker({ | ||
+ | position: myLatLng, | ||
+ | map: map, | ||
+ | icon: image, | ||
+ | shape: shape, | ||
+ | title: dungeon[0], | ||
+ | zIndex: dungeon[3] | ||
+ | }); | ||
+ | } | ||
} | } | ||
Revision as of 22:10, 6 April 2015