Physics.Ninja.Tile#Tile

new Tile(body, x, y, width, height, type)

Ninja Physics Tile constructor.
A Tile is defined by its width, height and type. It's type can include slope data, such as 45 degree slopes, or convex slopes.
Understand that for any type including a slope (types 2 to 29) the Tile must be SQUARE, i.e. have an equal width and height.
Also note that as Tiles are primarily used for levels they have gravity disabled and world bounds collision disabled by default.

Note: This class could be massively optimised and reduced in size. I leave that challenge up to you.

Parameters
Name Type Argument Default Description
body Phaser.Physics.Ninja.Body

The body that owns this shape.

x number

The x coordinate to create this shape at.

y number

The y coordinate to create this shape at.

width number

The width of this AABB.

height number

The height of this AABB.

type number <optional>
1

The type of Ninja shape to create. 1 = AABB, 2 = Circle or 3 = Tile.

Source code: physics/ninja/Tile.js (Line 25)
doc_phaser
2017-02-14 11:00:43
Comments
Leave a Comment

Please login to continue.