Jump to content


rickster

Member Since 27 Sep 2010
Offline Last Active May 15 2013 12:02 AM

Topics I've Started

Game Maker GeoLocation

28 December 2012 - 03:46 AM

Game Maker GeoLocation

Description

This adds three simple functions to GM that allow you to get the user's current location. The location will be more accurate on devices with a GPS, like mobile phones. It will still work on computers, but may be less accurate. It uses the JavaScript GeoLocation features. Since these are asynchronous, there cannot be one function to simply get the user's location. You must first request the location and then check back to get it.

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.

I believe the GeoLocation features in JavaScript can detect if the user has denied access, and plan to update this as I learn more about it (and JavaScript itself). I realize that this, in its current state, is extremely simple. It is the first extension I have ever made (actually, the first thing I have ever written in Javascript), so please give me any suggestions. I would appreciate the help. I was just so happy that it worked I wanted to share it with someone! I plan to add more features, as I see that you can also get the user's altitude, as well as the accuracy of the GPS in the device, and other things. I plan to add functions for them all. As of now, it just does locations.

About the security of this, because some people may be paranoid about Game Maker games knowing their location. Browsers are required to ask the user before returning any GeoLocation data, so there is no way to track them without their knowledge. If you don't want your location known to a game, you can simply deny access and the game will not be able to get it. Read more about the security of JavaScript's GeoLocation API here.

More features to come, please reply with any comments or suggestions!

Downloads

[1.0] Download Here (.gex)

Functions

  • 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

Browsers
  • Internet Explorer 9.0+
  • Chome 5.0+
  • Safari 5.0+
  • Firefox 3.5+
  • Opera 10.60+
Devices
  • Android 2.0+
  • iPhone 3.0+
  • Opera Mobile 10.1+
  • Symbian (S60 3rd & 5th generation)
  • Blackberry OS 6
  • Maemo
Compatible Devices List Source

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".

See It
Get It

Saving Files in GM:Studio

07 November 2012 - 10:33 PM

The functions file_text_open_read and file_text_open_write used to allow entering a full path to save/read from anywhere on the system, but in GM:Studio, it appears only partial paths are allowed and the files save in the game's special folder in %localappdata%. I realize that this is required for HTML5 games, because content that runs on a website cannot access all the files in your computer, but what about Windows games? Downloaded games should be able to do this (it was possible in GM7 and GM8).

- Is it currently possible for games made with Studio to save and read data from anywhere on the computer (like it used to work in GM7 and GM8)?
- If not, is it a bug? Was this made for HTML5 and somehow worked into all versions? Is there any plans to support this?
- Finally, if this has been removed with no intention of being added again, is there a .dll that can read and write text files available?

I appreciate all the info you can provide,
- Rickster

No HTML5 in iframes?

27 November 2011 - 02:22 PM

I use Internet Explorer 9 on Windows 7 64 bit, and HTML5 works just fine.
When I place an iframe to an HTML5 page it says "Your browser does not support the HTML5 canvas." in the iframe. It works directly, but through the iframe it is not supported? This is not just my games, it happens with other ones too, and it seems to work in other browsers, just not IE9.
Is there a way to make HTML5 work in an iframe on IE? I mean, for testing it's fine for me to use another browser, but considering a majority of internet users use IE, it'd be nice to have it working.
I searched quite a bit for this, so I hope this isn't just a repeat of other topics. It seems like others should have had this problem before me, but I couldn't find anything. Thanks for any help you could provide,

- Rickster

Game Maker 7 Block Engine

12 April 2011 - 08:51 PM

I downloaded the "Block Engine" (Link) but then I found out that I could not open the .gmk file, it was made in game maker 8, I only have 7. I downloaded the Lite version of Game Maker 8 so I could see the .gmk file, I could not run it since it uses 3d which is only availible in pro, so I copied everything, (all sprites, backgrounds, scripts, objects, and rooms) into a new Game Maker 7 game. When I tried to run my GM7 version, I got a strange problem:

Posted Image

Some of the blocks are not drawn! They act as if they are there, I can destroy them, and even add new blocks. They just do not show up! Since this is an exact copy of the GM8 game in GM7, I do not see what is wrong. Does GM7 do 3D different than GM8? Is there any way to make this work, or do I have to get GM8 to use the block engine? In case it helps, here is my GM7 version of the block engine: (Link)