Hi,
Digging up an old thread :)
I'm currently trying to develop a geolocation based game with Construct. However I'm struggling to implement a working solution.
I tried using the ExecJS function in the Browser object to run the geolocation feature but I don't really know how to store latitude and longitude values into C2 variables.
Here is my script so far (excuse the messy solution used, I've never used javascript before and I tried several things but always get returned zero in my latitude variable, I'm not even asked for geolocation permission)
Browser.ExecJS("
var position;
function getLocation(p)
{
if (navigator.geolocation)
{
navigator.geolocation.watchPosition(function (position){
"&Text.latitude &"= position.coords.latitude; }
);
}
}
")