To use this, run "reqLocation()" to request the user's location. Then check (probably in the step event) if "getLongitude()" and "getLatitude()" return something other than zero. If they both return zero, the user's location is still not available. Once the location is available, they will return the user's location. Realize that if the user has denied access, they will always return zero.
More features to come, please reply with any comments or suggestions!
[1.0] Download Here (.gex)
- reqLocation() - Requests the user's location. Returns 0 if the browser does not support geolocation. Returns 1 otherwise (even if the user denies access).
- getLongitude() - Returns the longitude coordinate. Can only be used after you have run reqLocation(). This will return 0 if the location has not yet been returned. It is not instant!
- getLatitude() - Returns the latitude coordinate. Can only be used after you have run reqLocation(). This will return 0 if the location has not yet been returned. It is not instant!
Compatible Browsers and Devices
- Internet Explorer 9.0+
- Chome 5.0+
- Safari 5.0+
- Firefox 3.5+
- Opera 10.60+
- Android 2.0+
- iPhone 3.0+
- Opera Mobile 10.1+
- Symbian (S60 3rd & 5th generation)
- Blackberry OS 6
Examples and Demos
Game Maker Simple GPS Demo
This example is an extremely simple demonstration of what GeoLocation can do. It will display your latitude and longitude coordinates on the screen. When you first run the example, you will be asked whether or not you want to allow the website to use your location. If you deny the website access, you will see "ERROR" for the coordinates. You can see it in action by clicking "See it" and you can download the heavily commented example as a .gmz by clicking "Get it".