Legacy:RestartGame

From Spherical
Revision as of 22:10, 1 June 2013 by Apollolux (talk | contribs) (created from http://web.archive.org/web/20110805022216/http://www.spheredev.org/wiki/RestartGame)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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