W3cubDocs

/Phaser

Class: Phaser.Component.InWorld

Constructor

new InWorld()

The InWorld component checks if a Game Object is within the Game World Bounds.
An object is considered as being "in bounds" so long as its own bounds intersects at any point with the World bounds.
If the AutoCull component is enabled on the Game Object then it will check the Game Object against the Camera bounds as well.

Source code: gameobjects/components/InWorld.js (Line 14)

Public Properties

checkWorldBounds : boolean

If this is set to true the Game Object checks if it is within the World bounds each frame.

When it is no longer intersecting the world bounds it dispatches the onOutOfBounds event.

If it was previously out of bounds but is now intersecting the world bounds again it dispatches the onEnterBounds event.

It also optionally kills the Game Object if outOfBoundsKill is true.

When checkWorldBounds is enabled it forces the Game Object to calculate its full bounds every frame.

This is a relatively expensive operation, especially if enabled on hundreds of Game Objects. So enable it only if you know it's required,
or you have tested performance and find it acceptable.

Source code: gameobjects/components/InWorld.js (Line 98)

[readonly] inWorld : boolean

Checks if the Game Objects bounds are within, or intersect at any point with the Game World bounds.

Source code: gameobjects/components/InWorld.js (Line 129)

outOfBoundsKill : boolean

If this and the checkWorldBounds property are both set to true then the kill method is called as soon as inWorld returns false.

Source code: gameobjects/components/InWorld.js (Line 106)

outOfCameraBoundsKill : boolean

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.

Source code: gameobjects/components/InWorld.js (Line 115)

Public Methods

<static> preUpdate()

The InWorld component preUpdate handler.
Called automatically by the Game Object.

Source code: gameobjects/components/InWorld.js (Line 22)

© 2016 Richard Davey, Photon Storm Ltd.
Licensed under the MIT License.
http://phaser.io/docs/2.6.2/Phaser.Component.InWorld.html