Thunkable X- Map Marker Proximity Sensor

For a school project I need to make map markers that output sound at various levels based on your location to it. Say at 100 ft it plays a volume one at 75 ft volume 2, 50ft volume 3 and so on. I have no idea how to do this and need help. I also need to use thunkable x as it needs to work on Iphones. Thanks.

Kobe,

I’m not sure that the Thunkable ✕ Location Sensor is quite accurate enough to distinguish 25 foot differences but it might be worth testing! Assuming it is accurate enough I would use the Location Sensor within a Timer component’s ‘Fire’ event block to periodically get the phones location and compare it to the school’s location.

An outline of the code might look something like this:
59%20PM

In the “check proximity to school” function you would do the math to calculate the distance between the phone and the school and play your sound (with the Sound component) at the appropriate volume. You would do that based on the latitude and longitude of the phone, which is passed in to the function and the known, fixed, latitude and longitude of the school.

Note that you should probably set 'EnableHighAccuracy' to true in the designer for the Location Sensor, though as I said I’m not sure if even that will give you enough accuracy.

-Mark

2 Likes

Mark,

I understand how to do most of this and thank you for taking the time to explain it. The only place where I am hung up, and I am still very new to Thunkable is with the math. I understand how to input the math, but i don’t understand how to do it with both latitude and longitude and from there where to put the sound component to play.

Thanks,
Kobe