With this function you can end the game (and the Game End Event will be triggered). This will not happen instantaneously, but rather at the end of the current step, so any code you have in the same step after this function has been called will still run. Please note that this function has the following restrictions:
- On Android (and Amazon Fire) devices, calling game_end() will push the app into the background, but it will not close the app. This must be done by the user.
- On iOS it will do nothing and silently fail.
- On UWP, XBoxOne, PS4 and Nintendo Switch it will crash the game and so must not be used.
- On HTML5 it will end the game, but leave the user staring at a blank draw canvas on the web page, and as such it isn't recommended that it be used on that target platform.
- On Windows, Linux and Mac the function simply ends the game and closes the game window ( a Game End Event will be triggered).
if keyboard_check_pressed(vk_escape) game_end();
This would end the game if the player presses the "escape" key.