Skip to content

Commit bcddfc8

Browse files
committed
Sprite.alive property now explicitly defined on the Sprite prototype (thanks @lewster32, phaserjs#841)
1 parent 2a73652 commit bcddfc8

3 files changed

Lines changed: 9 additions & 1 deletion

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ Version 2.0.6 - "Jornhill" - -in development-
5252

5353
### Bug Fixes
5454

55+
* Sprite.alive property now explicitly defined on the Sprite prototype (thanks @lewster32, #841)
56+
5557
### Migration Guide
5658

5759
There is an extensive [Migration Guide](https://github.com/photonstorm/phaser/blob/master/resources/Migration%20Guide.md) available for those converting from Phaser 1.x to 2.x. In the guide we detail the API breaking changes and approach to our new physics system.

build/phaser.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3724,7 +3724,7 @@ declare module Phaser {
37243724
circle: Phaser.Circle;
37253725
clientX: number;
37263726
clientY: number;
3727-
duation: number;
3727+
duration: number;
37283728
exists: boolean;
37293729
game: Phaser.Game;
37303730
id: number;

src/gameobjects/Sprite.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,12 @@ Phaser.Sprite = function (game, x, y, key, frame) {
116116
*/
117117
this.body = null;
118118

119+
/**
120+
* @property {boolean} alive - A useful boolean to control if the Sprite is alive or dead (in terms of your gameplay, it doesn't effect rendering). Also linked to Sprite.health and Sprite.damage.
121+
* @default
122+
*/
123+
this.alive = true;
124+
119125
/**
120126
* @property {number} health - Health value. Used in combination with damage() to allow for quick killing of Sprites.
121127
*/

0 commit comments

Comments
 (0)