Web And HTML5

GameMaker Studio 2 provides various functions for interacting with the internet or with a server, and they can be used on all the available target platforms. These functions are:



Apart from the general functions listed above, the HTML5 target has some additional web functions that are specifically designed to be used by the games that target it:



Apart from these functions for the HTML5 target module, there is also a special JavaScript variable that can be used on those rare occasions when the contents of the html5game folder are stored in a completely different place (URL). Normally this path is hard-coded in the JavaScript file and is relative to the location from where the JavaScript is called, but you can set the variable g_GameMakerHTML5Dir before the call to the game script and the game will be run from the newly defined location. For example:

<script>var g_GameMakerHTML5Dir = "http://mygamealternatedirectory.com/";</script>

It's also worth noting that you can flag script functions using the prefix gmcallback_ which means they won't be obfuscated when you compile the project for HTML5. This is very uiseful when using the above listed clickable_* functions (for more information, please see here).