Physics.Ninja#enableTile()

enableTile(object, id, children)

This will create a Ninja Physics Tile body on the given game object. There are 34 different types of tile you can create, including 45 degree slopes,
convex and concave circles and more. The id parameter controls which Tile type is created, but you can also change it at run-time.
Note that for all degree based tile types they need to have an equal width and height. If the given object doesn't have equal width and height it will use the width.
A game object can only have 1 physics body active at any one time, and it can't be changed until the object is destroyed.

Parameters
Name Type Argument Default Description
object object | array | Phaser.Group

The game object to create the physics body on. Can also be an array or Group of objects, a body will be created on every child that has a body property.

id number <optional>
1

The type of Tile this will use, i.e. Phaser.Physics.Ninja.Tile.SLOPE_45DEGpn, Phaser.Physics.Ninja.Tile.CONVEXpp, etc.

children boolean <optional>
true

Should a body be created on all children of this object? If true it will recurse down the display list as far as it can go.

Source code: physics/ninja/World.js (Line 104)
doc_phaser
2017-02-14 10:59:56
Comments
Leave a Comment

Please login to continue.