Physics.Ninja.Circle
Class: Phaser.Physics.Ninja.Circle
Constructor
new Circle(body, x, y, radius)
Ninja Physics Circle constructor.
Note: This class could be massively optimised and reduced in size. I leave that challenge up to you.
Parameters
Name | Type | 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. |
radius | number | The radius of this Circle. |
- Source code: physics/ninja/Circle.js (Line 19)
Public Properties
- Source code: physics/ninja/Circle.js (Line 24)
- Source code: physics/ninja/Circle.js (Line 90)
- Source code: physics/ninja/Circle.js (Line 68)
- Source code: physics/ninja/Circle.js (Line 39)
- Source code: physics/ninja/Circle.js (Line 34)
- Source code: physics/ninja/Circle.js (Line 44)
- Source code: physics/ninja/Circle.js (Line 29)
- Source code: physics/ninja/Circle.js (Line 85)
- Source code: physics/ninja/Circle.js (Line 62)
- Source code: physics/ninja/Circle.js (Line 50)
- Source code: physics/ninja/Circle.js (Line 56)
body
Properties:
Name | Type | Description |
---|---|---|
system | Phaser.Physics.Ninja.Body | A reference to the body that owns this shape. |
circleTileProjections : Object
All of the collision response handlers.
[readonly] height : number
The height.
oldpos : Phaser.Point
The position of this object in the previous update.
pos : Phaser.Point
The position of this object.
radius : number
The radius of this circle shape.
system : Phaser.Physics.Ninja
A reference to the physics system.
velocity : Phaser.Point
The velocity of this object.
[readonly] width : number
The width.
[readonly] xw : number
Half the width.
[readonly] yw
Properties:
Name | Type | Description |
---|---|---|
xw | number | Half the height. |
Public Methods
- Source code: physics/ninja/Circle.js (Line 248)
- Source code: physics/ninja/Circle.js (Line 207)
- Source code: physics/ninja/Circle.js (Line 2612)
- Source code: physics/ninja/Circle.js (Line 112)
- Source code: physics/ninja/Circle.js (Line 1719)
- Source code: physics/ninja/Circle.js (Line 1427)
- Source code: physics/ninja/Circle.js (Line 447)
- Source code: physics/ninja/Circle.js (Line 2307)
- Source code: physics/ninja/Circle.js (Line 2022)
- Source code: physics/ninja/Circle.js (Line 717)
- Source code: physics/ninja/Circle.js (Line 951)
- Source code: physics/ninja/Circle.js (Line 335)
- Source code: physics/ninja/Circle.js (Line 1193)
- Source code: physics/ninja/Circle.js (Line 2622)
- Source code: physics/ninja/Circle.js (Line 132)
- Source code: physics/ninja/Circle.js (Line 310)
collideCircleVsTile(t) → {boolean}
Collides this Circle with a Tile.
Parameters
Name | Type | Description |
---|---|---|
t | Phaser.Physics.Ninja.Tile | The Tile involved in the collision. |
Returns
True if they collide, otherwise false.
collideWorldBounds()
Collides this Circle against the world bounds.
destroy()
Destroys this Circle's reference to Body and System
integrate()
Updates this Circles position.
projCircle_22DegB(x, y, oH, oV, obj, t) → {number}
Resolves 22 Degree tile collision.
Parameters
Name | Type | Description |
---|---|---|
x | number | Penetration depth on the x axis. |
y | number | Penetration depth on the y axis. |
oH | number | Grid / voronoi region. |
oV | number | Grid / voronoi region. |
obj | Phaser.Physics.Ninja.Circle | The Circle involved in the collision. |
t | Phaser.Physics.Ninja.Tile | The Tile involved in the collision. |
Returns
The result of the collision.
projCircle_22DegS(x, y, oH, oV, obj, t) → {number}
Resolves 22 Degree tile collision.
Parameters
Name | Type | Description |
---|---|---|
x | number | Penetration depth on the x axis. |
y | number | Penetration depth on the y axis. |
oH | number | Grid / voronoi region. |
oV | number | Grid / voronoi region. |
obj | Phaser.Physics.Ninja.Circle | The Circle involved in the collision. |
t | Phaser.Physics.Ninja.Tile | The Tile involved in the collision. |
Returns
The result of the collision.
projCircle_45Deg(x, y, oH, oV, obj, t) → {number}
Resolves 45 Degree tile collision.
Parameters
Name | Type | Description |
---|---|---|
x | number | Penetration depth on the x axis. |
y | number | Penetration depth on the y axis. |
oH | number | Grid / voronoi region. |
oV | number | Grid / voronoi region. |
obj | Phaser.Physics.Ninja.Circle | The Circle involved in the collision. |
t | Phaser.Physics.Ninja.Tile | The Tile involved in the collision. |
Returns
The result of the collision.
projCircle_67DegB(x, y, oH, oV, obj, t) → {number}
Resolves 67 Degree tile collision.
Parameters
Name | Type | Description |
---|---|---|
x | number | Penetration depth on the x axis. |
y | number | Penetration depth on the y axis. |
oH | number | Grid / voronoi region. |
oV | number | Grid / voronoi region. |
obj | Phaser.Physics.Ninja.Circle | The Circle involved in the collision. |
t | Phaser.Physics.Ninja.Tile | The Tile involved in the collision. |
Returns
The result of the collision.
projCircle_67DegS(x, y, oH, oV, obj, t) → {number}
Resolves 67 Degree tile collision.
Parameters
Name | Type | Description |
---|---|---|
x | number | Penetration depth on the x axis. |
y | number | Penetration depth on the y axis. |
oH | number | Grid / voronoi region. |
oV | number | Grid / voronoi region. |
obj | Phaser.Physics.Ninja.Circle | The Circle involved in the collision. |
t | Phaser.Physics.Ninja.Tile | The Tile involved in the collision. |
Returns
The result of the collision.
projCircle_Concave(x, y, oH, oV, obj, t) → {number}
Resolves Concave tile collision.
Parameters
Name | Type | Description |
---|---|---|
x | number | Penetration depth on the x axis. |
y | number | Penetration depth on the y axis. |
oH | number | Grid / voronoi region. |
oV | number | Grid / voronoi region. |
obj | Phaser.Physics.Ninja.Circle | The Circle involved in the collision. |
t | Phaser.Physics.Ninja.Tile | The Tile involved in the collision. |
Returns
The result of the collision.
projCircle_Convex(x, y, oH, oV, obj, t) → {number}
Resolves Convex tile collision.
Parameters
Name | Type | Description |
---|---|---|
x | number | Penetration depth on the x axis. |
y | number | Penetration depth on the y axis. |
oH | number | Grid / voronoi region. |
oV | number | Grid / voronoi region. |
obj | Phaser.Physics.Ninja.Circle | The Circle involved in the collision. |
t | Phaser.Physics.Ninja.Tile | The Tile involved in the collision. |
Returns
The result of the collision.
projCircle_Full(x, y, oH, oV, obj, t) → {number}
Resolves Full tile collision.
Parameters
Name | Type | Description |
---|---|---|
x | number | Penetration depth on the x axis. |
y | number | Penetration depth on the y axis. |
oH | number | Grid / voronoi region. |
oV | number | Grid / voronoi region. |
obj | Phaser.Physics.Ninja.Circle | The Circle involved in the collision. |
t | Phaser.Physics.Ninja.Tile | The Tile involved in the collision. |
Returns
The result of the collision.
projCircle_Half(x, y, oH, oV, obj, t) → {number}
Resolves Half tile collision.
Parameters
Name | Type | Description |
---|---|---|
x | number | Penetration depth on the x axis. |
y | number | Penetration depth on the y axis. |
oH | number | Grid / voronoi region. |
oV | number | Grid / voronoi region. |
obj | Phaser.Physics.Ninja.Circle | The Circle involved in the collision. |
t | Phaser.Physics.Ninja.Tile | The Tile involved in the collision. |
Returns
The result of the collision.
render(context, xOffset, yOffset, color, filled)
Render this circle for debugging purposes.
Parameters
Name | Type | Description |
---|---|---|
context | object | The context to render to. |
xOffset | number | X offset from circle's position to render at. |
yOffset | number | Y offset from circle's position to render at. |
color | string | color of the debug shape to be rendered. (format is css color string). |
filled | boolean | Render the shape as solid (true) or hollow (false). |
reportCollisionVsWorld(px, py, dx, dy, obj)
Process a world collision and apply the resulting forces.
Parameters
Name | Type | Description |
---|---|---|
px | number | The tangent velocity |
py | number | The tangent velocity |
dx | number | Collision normal |
dy | number | Collision normal |
obj | number | Object this Circle collided with |
resolveCircleTile(x, y, oH, oV, obj, t) → {number}
Resolves tile collision.
Parameters
Name | Type | Description |
---|---|---|
x | number | Penetration depth on the x axis. |
y | number | Penetration depth on the y axis. |
oH | number | Grid / voronoi region. |
oV | number | Grid / voronoi region. |
obj | Phaser.Physics.Ninja.Circle | The Circle involved in the collision. |
t | Phaser.Physics.Ninja.Tile | The Tile involved in the collision. |
Returns
The result of the collision.
© 2016 Richard Davey, Photon Storm Ltd.
Licensed under the MIT License.
http://phaser.io/docs/2.6.2/Phaser.Physics.Ninja.Circle.html