Game Objects have a new property called state.

This commit is contained in:
Richard Davey 2018-11-07 15:11:59 +00:00
parent e34d759928
commit 601c7696c3
2 changed files with 17 additions and 0 deletions

View file

@ -7,6 +7,7 @@
* The data object being sent to the Dynamic Bitmap Text callback now has a new property `parent`, which is a reference to the Bitmap Text instance that owns the data object (thanks ornyth)
* The WebGL Renderer has a new method `clearPipeline`, which will clear down the current pipeline and reset the blend mode, ready for the context to be passed to a 3rd party library.
* The WebGL Renderer has a new method `rebindPipeline`, which will rebind the given pipeline instance, reset the blank texture and reset the blend mode. Which is useful for recovering from 3rd party libs that have modified the gl context.
* Game Objects have a new property called `state`. Use this to track the state of a Game Object during its lifetime. For example, it could move from a state of 'moving', to 'attacking', to 'dead'. Phaser itself will never set this property, although plugins are allowed to.
### Updates

View file

@ -55,6 +55,22 @@ var GameObject = new Class({
*/
this.type = type;
/**
* The current state of this Game Object.
*
* Phaser itself will never modify this value, although plugins may do so.
*
* Use this property to track the state of a Game Object during its lifetime. For example, it could move from
* a state of 'moving', to 'attacking', to 'dead'. The state value should typically be an integer (ideally mapped to a constant
* in your game code), but could also be a string, or any other data-type. It is recommended to keep it light and simple.
* If you need to store complex data about your Game Object, look at using the Data Component instead.
*
* @name Phaser.GameObjects.GameObject#state
* @type {{integer|string}}
* @since 3.16.0
*/
this.state = 0;
/**
* The parent Container of this Game Object, if it has one.
*