2013-10-30 03:46:52 +00:00
2013-10-28 23:29:04 +00:00
BasicGame . Game = function ( game ) {
2013-11-01 04:58:08 +00:00
// When a State is added to Phaser it automatically has the following properties set on it, even if they already exist:
this . game ; // a reference to the currently running game
this . add ; // used to add sprites, text, groups, etc
this . camera ; // a reference to the game camera
this . cache ; // the game cache
this . input ; // the global input manager (you can access this.input.keyboard, this.input.mouse, as well from it)
this . load ; // for preloading assets
this . math ; // lots of useful common math operations
this . sound ; // the sound manager - add a sound, play one, set-up markers, etc
this . stage ; // the game stage
this . time ; // the clock
2014-02-25 14:46:48 +00:00
this . tweens ; // the tween manager
this . state ; // the state manager
2013-11-01 04:58:08 +00:00
this . world ; // the game world
this . particles ; // the particle manager
this . physics ; // the physics manager
this . rnd ; // the repeatable random number generator
// You can use any of these from any function within this State.
// But do consider them as being 'reserved words', i.e. don't create a property for your own game called "world" or you'll over-write the world reference.
2013-10-28 23:29:04 +00:00
} ;
BasicGame . Game . prototype = {
create : function ( ) {
// Honestly, just about anything could go here. It's YOUR game after all. Eat your heart out!
} ,
update : function ( ) {
// Honestly, just about anything could go here. It's YOUR game after all. Eat your heart out!
} ,
quitGame : function ( pointer ) {
// Here you should destroy anything you no longer need.
// Stop music, delete sprites, purge caches, free resources, all that good stuff.
// Then let's go back to the main menu.
2014-02-25 14:46:48 +00:00
this . state . start ( 'MainMenu' ) ;
2013-10-28 23:29:04 +00:00
}
} ;