phaser/src/core/State.js

155 lines
3.1 KiB
JavaScript
Raw Normal View History

/**
2013-10-01 12:54:29 +00:00
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2013 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
* @module Phaser.State
*/
/**
2013-09-13 04:44:04 +00:00
* This is a base State class which can be extended if you are creating your own game.
* It provides quick access to common functions such as the camera, cache, input, match, sound and more.
*
2013-10-01 12:54:29 +00:00
* @class Phaser.State
* @constructor
*/
Phaser.State = function () {
2013-10-01 12:54:29 +00:00
/**
* @property {Phaser.Game} game - A reference to the currently running Game.
*/
this.game = null;
2013-10-01 12:54:29 +00:00
/**
* @property {Description} add - Description.
* @default
*/
this.add = null;
2013-10-01 12:54:29 +00:00
/**
* @property {Phaser.Physics.PhysicsManager} camera - A handy reference to world.camera.
* @default
*/
this.camera = null;
2013-10-01 12:54:29 +00:00
/**
* @property {Phaser.Cache} cache - Reference to the assets cache.
* @default
*/
this.cache = null;
2013-10-01 12:54:29 +00:00
/**
* @property {Phaser.Input} input - Reference to the input manager
* @default
*/
this.input = null;
2013-10-01 12:54:29 +00:00
/**
* @property {Phaser.Loader} load - Reference to the assets loader.
* @default
*/
this.load = null;
2013-10-01 12:54:29 +00:00
/**
* @property {Phaser.GameMath} math - Reference to the math helper.
* @default
*/
2013-09-13 04:44:04 +00:00
this.math = null;
2013-10-01 12:54:29 +00:00
/**
* @property {Phaser.SoundManager} sound - Reference to the sound manager.
* @default
*/
this.sound = null;
2013-10-01 12:54:29 +00:00
/**
* @property {Phaser.Stage} stage - Reference to the stage.
* @default
*/
this.stage = null;
2013-10-01 12:54:29 +00:00
/**
* @property {Phaser.TimeManager} time - Reference to game clock.
* @default
*/
this.time = null;
2013-10-01 12:54:29 +00:00
/**
* @property {Phaser.TweenManager} tweens - Reference to the tween manager.
* @default
*/
this.tweens = null;
2013-10-01 12:54:29 +00:00
/**
* @property {Phaser.World} world - Reference to the world.
* @default
*/
this.world = null;
2013-10-01 12:54:29 +00:00
/**
* @property {Description} add - Description.
* @default
*/
this.particles = null;
2013-10-01 12:54:29 +00:00
/**
* @property {Phaser.Physics.PhysicsManager} physics - Reference to the physics manager.
* @default
*/
this.physics = null;
};
Phaser.State.prototype = {
/**
* Override this method to add some load operations.
* If you need to use the loader, you may need to use them here.
2013-10-01 12:54:29 +00:00
*
* @method preload
*/
preload: function () {
},
/**
* This method is called after the game engine successfully switches states.
2013-10-01 12:54:29 +00:00
* Feel free to add any setup code here (do not load anything here, override preload() instead).
*
* @method create
*/
create: function () {
},
/**
* Put update logic here.
2013-10-01 12:54:29 +00:00
*
* @method update
*/
update: function () {
},
/**
* Put render operations here.
2013-10-01 12:54:29 +00:00
*
* @method render
*/
render: function () {
},
/**
* This method will be called when game paused.
2013-10-01 12:54:29 +00:00
*
* @method paused
*/
paused: function () {
},
/**
2013-10-01 12:54:29 +00:00
* This method will be called when the state is destroyed.#
* @method destroy
*/
destroy: function () {
}
};