Phaser.Component.InWorld = function (){ } ; Phaser.Component.InWorld.preUpdate = function (){ if (this.autoCull || this.checkWorldBounds) { this._bounds.copyFrom(this.getBounds()); this._bounds.x += this.game.camera.view.x; this._bounds.y += this.game.camera.view.y; if (this.autoCull) { if (this.game.world.camera.view.intersects(this._bounds)) { this.renderable = true ; this.game.world.camera.totalInView++ ; } else { this.renderable = false ; if (this.outOfCameraBoundsKill) { this.kill(); return false ; } } } if (this.checkWorldBounds) { if (this._outOfBoundsFired && this.game.world.bounds.intersects(this._bounds)) { this._outOfBoundsFired = false ; this.events.onEnterBounds$dispatch(this); } else if (!this._outOfBoundsFired && !this.game.world.bounds.intersects(this._bounds)) { this._outOfBoundsFired = true ; this.events.onOutOfBounds$dispatch(this); if (this.outOfBoundsKill) { this.kill(); return false ; } } } } return true ; } ; Phaser.Component.InWorld.prototype = { checkWorldBounds: false , outOfBoundsKill: false , outOfCameraBoundsKill: false , _outOfBoundsFired: false , inWorld: { get: function (){ return this.game.world.bounds.intersects(this.getBounds()); } } } ;