Added ability to kill a Game Object when it leaves camera bounds.

This commit is contained in:
Jake Wilson 2016-03-28 20:34:00 -04:00
parent 268b13392b
commit ae663f97aa

View file

@ -40,6 +40,12 @@ Phaser.Component.InWorld.preUpdate = function () {
else
{
this.renderable = false;
if (this.outOfCameraBoundsKill)
{
this.kill();
return false;
}
}
}
@ -99,6 +105,15 @@ Phaser.Component.InWorld.prototype = {
*/
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.
* @private