Merge pull request #2402 from jakewilson/dev

Added ability to kill a Game Object when it leaves camera bounds.
This commit is contained in:
Richard Davey 2016-04-04 21:52:30 +01:00
commit 8e880eddee

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