game_restart

Restarts the game.

Syntax:

GML Code Example

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.


Example:

GML Code Example

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

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


Next: game_load



No Examples Submitted

Does this page need better examples? Be the first to Submit

No Edits Suggested

Is this page unclear or not descriptive enough? Suggest an edit to the page and with enough upvotes your changes will be made.

No Questions Have Been Ask

Do you have a question about this page? Ask it Here