enable(object, type, id, radius, children)
This will create a Ninja Physics body on the given game object or array of game objects.
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 | ||
type | number | <optional> | 1 | The type of Ninja shape to create. 1 = AABB, 2 = Circle or 3 = Tile. |
id | number | <optional> | 1 | If this body is using a Tile shape, you can set the Tile id here, i.e. Phaser.Physics.Ninja.Tile.SLOPE_45DEGpn, Phaser.Physics.Ninja.Tile.CONVEXpp, etc. |
radius | number | <optional> | 0 | If this body is using a Circle shape this controls the radius. |
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 121)
Please login to continue.