new Body(system, sprite, type, id, radius, x, y, width, height)
The Physics Body is linked to a single Sprite. All physics operations should be performed against the body rather than
the Sprite itself. For example you can set the velocity, bounce values etc all on the Body.
Parameters
Name | Type | Argument | Default | Description |
---|---|---|---|---|
system | Phaser.Physics.Ninja | The physics system this Body belongs to. | ||
sprite | Phaser.Sprite | The Sprite object this physics body belongs to. | ||
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> | 16 | If this body is using a Circle shape this controls the radius. |
x | number | <optional> | 0 | The x coordinate of this Body. This is only used if a sprite is not provided. |
y | number | <optional> | 0 | The y coordinate of this Body. This is only used if a sprite is not provided. |
width | number | <optional> | 0 | The width of this Body. This is only used if a sprite is not provided. |
height | number | <optional> | 0 | The height of this Body. This is only used if a sprite is not provided. |
- Source code: physics/ninja/Body.js (Line 23)
Please login to continue.