I should probably mention that I am not an expert web designer. Could you maybe translate that to "took one html course in high school" language by any chance? Also, where do I put these "extensions" in gamemaker studio 2?
Oh , no problem
I thought you may have had a little more experience with web development since you're using the HTML5 module
First things first though, I would suggest reading up on how to create an extension:
GMS 2
Now on your website, do you have a page for the game on your website, not the actual game itself? (a page that may contain information about the game with a "Play" button that will then open the games URL). If you do, then great. If you don't, I suggest familiarizing yourself with web pages again, using HTML and JavaScript.
If you're using a website builder it should be fairly easy, as most website builders that provide a button, also provide a textbox to insert custom JS.
If you have a raw website that you're building on your own, then using this mark up in html will insert a button:
Code:
<button id="btnPlayGame" onclick="OpenGameTab()">Play</button>
And inserting JavaScript into the webpage is as simple as:
Code:
<script type="text/javascript">
function OpenGameTab() {
var gameWindow = window.open();
gameWindow.location = "http://YourURL";
}
</script>
Then create a custom JS file, simply using any notepad type program will work, this will be the JS file used by the extension.
In your custom file, now insert this JavaScript function:
Code:
function CloseGameTab() {
window.close();
}
If you read the documentation on how to create an extension, it should also help you to link the CloseGameTab function to the game and call it from GML in GMS.
Don't forget, you need to do an explicit check in GML to check that it is the HTML5 module itself, so on your game close do this:
Code:
if (os_browser != browser_not_a_browser) //if the game is being played in a browser
CloseGameTab(); //Or whatever you name the function in the extension.
Also, some more on checking browsers in the manual
here