[back to index]

Library Reference (v 0.11.0)

Scene

Scene management and control!

A Scene in Haxegon is a class with an update() function, and optionally with the following functions:
init() (called when you first change to this scene)
reset() (called every time your change to this scene)
render() (for optionally seperating your logic and drawing code)

The default Scene when your program starts is Main, but you can change this with the Scene.change() function.
Scene.change(newscene:Class)
Change the game's current scene.
Scene.restart(scenename:Class)
Discard and reload the named scene. Doesn't change to it (you still need to call Scene.change() afterwards), and doesn't have to be the currently running scene.
Scene.name(requiredscene:Class):Class
Returns the name of a scene as a String.
Scene.get(requiredscene:Class):Class
Advanced! Returns an instance of the required scene. Can be used to access that Scene's member variables, though alternatively you could just make that scene's functions static.