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:
- It will report an error on the Windows 8 and iOS modules as it is against the conditions of their respective Marketplaces.
- It will silently fail on the HTML5 module.
- It will work on Windows (including Steam Workshop), Windows Phone, Android, Linux and Mac.
if keyboard_check_pressed(vk_escape) game_end();
This would end the game if the player presses the "escape" key.