mirror of
https://github.com/photonstorm/phaser
synced 2024-11-23 21:24:09 +00:00
Merge pull request #2402 from jakewilson/dev
Added ability to kill a Game Object when it leaves camera bounds.
This commit is contained in:
commit
8e880eddee
1 changed files with 15 additions and 0 deletions
|
@ -40,6 +40,12 @@ Phaser.Component.InWorld.preUpdate = function () {
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.renderable = false;
|
this.renderable = false;
|
||||||
|
|
||||||
|
if (this.outOfCameraBoundsKill)
|
||||||
|
{
|
||||||
|
this.kill();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,6 +105,15 @@ Phaser.Component.InWorld.prototype = {
|
||||||
*/
|
*/
|
||||||
outOfBoundsKill: false,
|
outOfBoundsKill: false,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If this and the `autoCull` property are both set to `true`, then the `kill` method
|
||||||
|
* is called as soon as the Game Object leaves the camera bounds.
|
||||||
|
*
|
||||||
|
* @property {boolean} outOfCameraBoundsKill
|
||||||
|
* @default
|
||||||
|
*/
|
||||||
|
outOfCameraBoundsKill: false,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property {boolean} _outOfBoundsFired - Internal state var.
|
* @property {boolean} _outOfBoundsFired - Internal state var.
|
||||||
* @private
|
* @private
|
||||||
|
|
Loading…
Reference in a new issue