Difference between revisions of "Legacy:RestartGame"

From Spherical
Jump to: navigation, search
(created from http://web.archive.org/web/20110805022216/http://www.spheredev.org/wiki/RestartGame)
(No difference)

Revision as of 22:10, 1 June 2013

This simply restarts the game.

Usage

RestartGame();



Examples

RestartGame();

Restarts the game.

function SwitchResolution(width, height)
{
  var proj = OpenFile("../game.sgm");
  proj.write("screen_height", height);
  proj.write("screen_width", width);
  proj.flush();
  proj.close();
  RestartGame();
}

A function that allows you to easily change the resolution of the current game. The file operations set the game screen dimensions and save them. The RestartGame() call reinitialises Sphere, at which point the Sphere engine will actually change its size due to the numbers written in the game project file earlier.

Notes

All variables and things Sphere loaded into memory will be cleaned from memory as if you just started the game.

See also