game_restart

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.

NOTE You will not be able to create new instances of objects in the same event after this function is called. There is one exception: if the object you're creating an instance of is already marked persistent, or its persistent variable is set to true in the variable struct passed into the instance_create_*() function, it will be created.

In the latter case (making the new instance persistent through the variable struct), the Variable Definitions for that instance will not be executed.

It should be noted that certain things will not be reset when this function is called:

Syntax:

game_restart();

 

Returns:

N/A

 

Example:

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

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