The game class is the core component of Thrunium. It has a list of variables and methods to use. It includes Events, Drawing methods and easy handling of assets.
When the game class is constructed it creates a canvas, a context2d, a gameloop and the standard events for your game. You can then use the game object to draw on the canvas, play audio and add events.
To use methods from the game object you have to contruct it. You can do so with the following code.
Contructs a game object. This object is used for many of the standard methods.
var game = new THRUNIUM.Game(<width>, <height>);
Here are some simple function to be used with the Game class
Initialize all vars, events, assets and prep gameloop. This function needs to be run before start and before you can manage assets outside of game.states.
var game = new THRUNIUM.Game(400, 400);
game.init();
// init game object
Start the gameloop.
var game = new THRUNIUM.Game(400, 400);
game.start();
// starts the gameloop
Stops the gameloop.
var game = new THRUNIUM.Game(400, 400);
game.stop();
// stops the gameloop
For more information on how Events, Drawing and Assets see the documentation for them.