mirror of
https://github.com/photonstorm/phaser
synced 2024-12-18 00:53:42 +00:00
commit
bae732ca9e
1 changed files with 14 additions and 14 deletions
|
@ -38,10 +38,10 @@ Phaser.Component.LifeSpan.prototype = {
|
|||
|
||||
/**
|
||||
* A useful flag to control if the Game Object is alive or dead.
|
||||
*
|
||||
*
|
||||
* This is set automatically by the Health components `damage` method should the object run out of health.
|
||||
* Or you can toggle it via your game code.
|
||||
*
|
||||
*
|
||||
* This property is mostly just provided to be used by your game - it doesn't effect rendering or logic updates.
|
||||
* However you can use `Group.getFirstAlive` in conjunction with this property for fast object pooling and recycling.
|
||||
* @property {boolean} alive
|
||||
|
@ -51,12 +51,12 @@ Phaser.Component.LifeSpan.prototype = {
|
|||
|
||||
/**
|
||||
* The lifespan allows you to give a Game Object a lifespan in milliseconds.
|
||||
*
|
||||
*
|
||||
* Once the Game Object is 'born' you can set this to a positive value.
|
||||
*
|
||||
*
|
||||
* It is automatically decremented by the millisecond equivalent of `game.time.physicsElapsed` each frame.
|
||||
* When it reaches zero it will call the `kill` method.
|
||||
*
|
||||
*
|
||||
* Very handy for particles, bullets, collectibles, or any other short-lived entity.
|
||||
*
|
||||
* @property {number} lifespan
|
||||
|
@ -66,9 +66,9 @@ Phaser.Component.LifeSpan.prototype = {
|
|||
|
||||
/**
|
||||
* Brings a 'dead' Game Object back to life, optionally resetting its health value in the process.
|
||||
*
|
||||
*
|
||||
* A resurrected Game Object has its `alive`, `exists` and `visible` properties all set to true.
|
||||
*
|
||||
*
|
||||
* It will dispatch the `onRevived` event. Listen to `events.onRevived` for the signal.
|
||||
*
|
||||
* @method
|
||||
|
@ -82,10 +82,10 @@ Phaser.Component.LifeSpan.prototype = {
|
|||
this.alive = true;
|
||||
this.exists = true;
|
||||
this.visible = true;
|
||||
|
||||
if (typeof this.health === 'number')
|
||||
|
||||
if (typeof this.heal === 'function')
|
||||
{
|
||||
this.health = health;
|
||||
this.heal(health);
|
||||
}
|
||||
|
||||
if (this.events)
|
||||
|
@ -99,12 +99,12 @@ Phaser.Component.LifeSpan.prototype = {
|
|||
|
||||
/**
|
||||
* Kills a Game Object. A killed Game Object has its `alive`, `exists` and `visible` properties all set to false.
|
||||
*
|
||||
*
|
||||
* It will dispatch the `onKilled` event. You can listen to `events.onKilled` for the signal.
|
||||
*
|
||||
* Note that killing a Game Object is a way for you to quickly recycle it in an object pool,
|
||||
*
|
||||
* Note that killing a Game Object is a way for you to quickly recycle it in an object pool,
|
||||
* it doesn't destroy the object or free it up from memory.
|
||||
*
|
||||
*
|
||||
* If you don't need this Game Object any more you should call `destroy` instead.
|
||||
*
|
||||
* @method
|
||||
|
|
Loading…
Reference in a new issue