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)
 
(added navbox)
 
Line 35: Line 35:
 
* [[API:Exit|Exit]]()
 
* [[API:Exit|Exit]]()
 
* [[API:Abort|Abort]]()
 
* [[API:Abort|Abort]]()
 +
 +
{{API:Engine/navbox}}

Latest revision as of 22:31, 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

API:Engine/navbox