mirror of
https://github.com/photonstorm/phaser
synced 2024-11-27 15:12:18 +00:00
Added ability to kill a Game Object when it leaves camera bounds.
This commit is contained in:
parent
268b13392b
commit
ae663f97aa
1 changed files with 15 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue