game_restart

Restarts the game.

Syntax:

game_restart();


Returns: N/A


Description

With this function you can restart the game. This is essentially the same as running the game for the first time and so the Game Start Event will be triggered, as well as the Game End Event. However it should be noted that global variables will not be re-initialised unless explicitly coded as such - for example, the built-in global variable score will not start at zero after a game restart if it has been modified in the game already. This is also the case for GPU state (so if you have set the draw colour or alpha, for example, it will remain at the changed value).


Example:

if keyboard_check_pressed(ord("R")) game_restart();

This would restart the game when the player presses the "R" key.


Back: Miscellaneous
Next: game_load
© Copyright YoYo Games Ltd. 2018 All Rights Reserved