Skip to content

Commit

Permalink
added pokemon to map
Browse files Browse the repository at this point in the history
  • Loading branch information
Reaver01 committed Jul 22, 2016
1 parent 25c3098 commit 8683532
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion web/catchable.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"pokemon_id": 41, "spawnpoint_id": "47957c8342b", "longitude": 6.644660700480692, "expiration_timestamp_ms": 1469221416684, "latitude": 49.75081094565466, "encounter_id": 16122124223608303245}
{"pokemon_id": 98, "spawnpoint_id": "47957c83343", "longitude": 6.643306996401487, "expiration_timestamp_ms": 1469226435660, "latitude": 49.750086771502254, "encounter_id": 12758640364511045325}
20 changes: 12 additions & 8 deletions web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
var cInfo = {};
var catchable = {};
var pokemonArray = {};
var div = document.createElement('div');
function initMap() {
map = new google.maps.Map(document.getElementById('map'), {
center: {lat: 50.0830986, lng: 6.7613762},
Expand Down Expand Up @@ -79,17 +78,22 @@
function(data) { cInfo = data; },
function(xhr) { console.error(xhr); }
);
loadJSON('../data/pokemon.json',
loadJSON('pokemondata.json',
function(data) { pokemonArray = data; },
function(xhr) { console.error(xhr); }
);
if(cInfo['latitude'] != undefined) {
console.log("New Marker: Catchable Pokemon - " + parseFloat(cInfo['latitude']) + ", " + parseFloat(cInfo['longitude']));
cMarker = new google.maps.Marker({
map: map,
position: {lat: parseFloat(cInfo['latitude']), lng: parseFloat(cInfo['longitude'])},
icon: "image/" + cInfo['pokemon_id'] + ".png"
});
if(cMarker == undefined) {
console.log("New Marker: Catchable Pokemon - " + parseFloat(cInfo['latitude']) + ", " + parseFloat(cInfo['longitude']));
cMarker = new google.maps.Marker({
map: map,
position: {lat: parseFloat(cInfo['latitude']), lng: parseFloat(cInfo['longitude'])},
icon: "image/icons/" + cInfo['pokemon_id'] + ".png"
});
}
console.log("Update Marker: Catchable Pokemon - " + parseFloat(cInfo['latitude']) + ", " + parseFloat(cInfo['longitude']));
cMarker.setPosition({lat: parseFloat(cInfo['latitude']), lng: parseFloat(cInfo['longitude'])});
cMarker.setIcon("image/icons/" + cInfo['pokemon_id'] + ".png");
}
}
function updateInventory() {
Expand Down
1 change: 1 addition & 0 deletions web/pokemondata.json

Large diffs are not rendered by default.

0 comments on commit 8683532

Please sign in to comment.