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) and for the game speed. Also note that if any
resource from the resource tree has been changed at run time within
the game - for example if you change the origin for a sprite
resource or shift the position of a path resource - then these will
not be reset either.
if keyboard_check_pressed(ord("R")) game_restart();
This would restart the game when the player presses the "R" key.