mirror of
https://github.com/mudabbir-ahmad/MAD-Treasure-Hunt.git
synced 2026-10-08 03:00:20 +00:00
Add ExpandedMapScreen and integrate it into navigation; enhance CacheCardItem and GameSettingsScreen with improved UI elements
This commit is contained in:
1 parent
60cf6baad2
commit
d34bb650f4
15 files changed
+426
-126
No files matched your search
@@ -1,5 +1,11 @@
|
||||
import * as geolib from 'geolib';
|
||||
|
||||
// Convert raw Magnetometer {x, y} reading to a 0-360° heading
|
||||
const toHeading = ({x, y}) => {
|
||||
const angle = Math.atan2(y, x) * (180 / Math.PI);
|
||||
return angle < 0 ? angle + 360 : angle;
|
||||
};
|
||||
|
||||
const isWithinRadius = (playerCoords, cacheCoords, radius) => {
|
||||
const distance = geolib.getDistance(playerCoords, cacheCoords);
|
||||
return distance <= radius;
|
||||
@@ -14,5 +20,5 @@ const isLookingAtCache = (playerHeading, playerCoords, cacheCoords, tolerance =
|
||||
return diff <= tolerance || diff >= 360 - tolerance;
|
||||
};
|
||||
|
||||
export { isWithinRadius, isLookingAtCache };
|
||||
export { toHeading, isWithinRadius, isLookingAtCache };
|
||||
|
||||
Reference in new issue
Block a user