diff --git a/twitch/chatguessr.js b/twitch/chatguessr.js index 35375e0..52d2d8b 100644 --- a/twitch/chatguessr.js +++ b/twitch/chatguessr.js @@ -28,19 +28,19 @@ } }; function moveFrom(coords, angle, distance) { - let radianAngle = (angle * Math.PI) / 180; - let x = 0 + distance * Math.cos(radianAngle); - let y = 0 + distance * Math.sin(radianAngle); - let newLat = coords.lat + y * M; - let newLng = coords.lng + (x * M) / Math.cos(coords.lat * (Math.PI / 180)); + var radianAngle = (angle * Math.PI) / 180; + var x = 0 + distance * Math.cos(radianAngle); + var y = 0 + distance * Math.sin(radianAngle); + var newLat = coords.lat + y * M; + var newLng = coords.lng + (x * M) / Math.cos(coords.lat * (Math.PI / 180)); return { lat: newLat, lng: newLng }; } function getSurroundings (location) { const meters = 100; const R_EARTH = 6378.137; const M = 1 / (((2 * Math.PI) / 360) * R_EARTH) / 1000; - let coordinates = [location]; - for (let angle = 0; angle < 360; angle += 45) { + var coordinates = [location]; + for (var angle = 0; angle < 360; angle += 45) { coordinates.push(moveFrom({ lat: location.lat, lng: location.lng }, angle, meters)); } return coordinates;