Class: Body

Phaser.Physics.Impact. Body

An Impact.js compatible physics body.
This re-creates the properties you'd get on an Entity and the math needed to update them.


new Body(world, x, y [, sx] [, sy])

Parameters:
Name Type Argument Default Description
world Phaser.Physics.Impact.World

[description]

x number

[description]

y number

[description]

sx number <optional>
16

[description]

sy number <optional>
16

[description]

Since: 3.0.0
Source: src/physics/impact/Body.js (Line 38)

Members


accel :Object

[description]

Type:
  • Object
Since: 3.0.0
Source: src/physics/impact/Body.js (Line 165)

accelAir :number

[description]

Type:
  • number
Since: 3.0.0
Default Value:
  • 0
Source: src/physics/impact/Body.js (Line 239)

accelGround :number

[description]

Type:
  • number
Since: 3.0.0
Default Value:
  • 0
Source: src/physics/impact/Body.js (Line 229)

bounciness :number

[description]

Type:
  • number
Since: 3.0.0
Source: src/physics/impact/Body.js (Line 211)

checkAgainst :Phaser.Physics.Impact.TYPE

[description]

Type:
Since: 3.0.0
Source: src/physics/impact/Body.js (Line 268)

collides :Phaser.Physics.Impact.COLLIDES

[description]

Type:
Since: 3.0.0
Source: src/physics/impact/Body.js (Line 277)

debugBodyColor :integer

[description]

Type:
  • integer
Since: 3.0.0
Source: src/physics/impact/Body.js (Line 304)

debugShowBody :boolean

[description]

Type:
  • boolean
Since: 3.0.0
Source: src/physics/impact/Body.js (Line 286)

debugShowVelocity :boolean

[description]

Type:
  • boolean
Since: 3.0.0
Source: src/physics/impact/Body.js (Line 295)

enabled :boolean

[description]

Type:
  • boolean
Since: 3.0.0
Default Value:
  • true
Source: src/physics/impact/Body.js (Line 82)

friction :Object

[description]

Type:
  • Object
Since: 3.0.0
Source: src/physics/impact/Body.js (Line 174)

gameObject :Phaser.GameObjects.GameObject

[description]

Type:
Since: 3.0.0
Default Value:
  • null
Source: src/physics/impact/Body.js (Line 72)

gravityFactor :number

[description]

Type:
  • number
Since: 3.0.0
Source: src/physics/impact/Body.js (Line 202)

id :integer

[description]

Type:
  • integer
Since: 3.0.0
Source: src/physics/impact/Body.js (Line 101)

jumpSpeed :number

[description]

Type:
  • number
Since: 3.0.0
Default Value:
  • 0
Source: src/physics/impact/Body.js (Line 249)

last :Object

[description]

Type:
  • Object
Since: 3.0.0
Source: src/physics/impact/Body.js (Line 147)

maxVel :Object

[description]

Type:
  • Object
Since: 3.0.0
Source: src/physics/impact/Body.js (Line 183)

minBounceVelocity :number

[description]

Type:
  • number
Since: 3.0.0
Source: src/physics/impact/Body.js (Line 220)

name :string

[description]

Type:
  • string
Since: 3.0.0
Default Value:
  • ''
Source: src/physics/impact/Body.js (Line 110)

offset :Object

[description]

Type:
  • Object
Since: 3.0.0
Source: src/physics/impact/Body.js (Line 129)

<nullable> parent :Phaser.Physics.Impact.ImpactBody|Phaser.Physics.Impact.ImpactImage|Phaser.Physics.Impact.ImpactSprite

The ImpactBody, ImpactSprite or ImpactImage object that owns this Body, if any.

Type:
Since: 3.0.0
Source: src/physics/impact/Body.js (Line 92)

pos :Object

[description]

Type:
  • Object
Since: 3.0.0
Source: src/physics/impact/Body.js (Line 138)

size :Object

[description]

Type:
  • Object
Since: 3.0.0
Source: src/physics/impact/Body.js (Line 120)

slopeStanding :Object

min 44 deg, max 136 deg

Type:
  • Object
Since: 3.0.0
Source: src/physics/impact/Body.js (Line 322)

standing :boolean

[description]

Type:
  • boolean
Since: 3.0.0
Default Value:
  • false
Source: src/physics/impact/Body.js (Line 192)

type :Phaser.Physics.Impact.TYPE

[description]

Type:
Since: 3.0.0
Source: src/physics/impact/Body.js (Line 259)

<nullable> updateCallback :BodyUpdateCallback

[description]

Type:
Since: 3.0.0
Source: src/physics/impact/Body.js (Line 313)

vel :Object

[description]

Type:
  • Object
Since: 3.0.0
Source: src/physics/impact/Body.js (Line 156)

world :Phaser.Physics.Impact.World

[description]

Type:
Since: 3.0.0
Source: src/physics/impact/Body.js (Line 63)

Methods


check(other)

Can be overridden by user code

Parameters:
Name Type Description
other Phaser.Physics.Impact.Body

[description]

Since: 3.0.0
Source: src/physics/impact/Body.js (Line 548)

collideWith(other, axis)

Can be overridden by user code

Parameters:
Name Type Description
other Phaser.Physics.Impact.Body

[description]

axis string

[description]

Since: 3.0.0
Source: src/physics/impact/Body.js (Line 560)

destroy()

[description]

Since: 3.0.0
Source: src/physics/impact/Body.js (Line 592)

drawDebug(graphic)

[description]

Parameters:
Name Type Description
graphic Phaser.GameObjects.Graphics

[description]

Since: 3.0.0
Source: src/physics/impact/Body.js (Line 409)

fromJSON(config)

[description]

Parameters:
Name Type Description
config object

[description]

Since: 3.0.0
Source: src/physics/impact/Body.js (Line 535)
To Do:
  • Code it!

handleMovementTrace(res)

Can be overridden by user code but must return a boolean.

Parameters:
Name Type Description
res number

[description]

Since: 3.0.0
Source: src/physics/impact/Body.js (Line 577)
Returns:

[description]

Type
boolean

reset(x, y)

[description]

Parameters:
Name Type Description
x number

[description]

y number

[description]

Since: 3.0.0
Source: src/physics/impact/Body.js (Line 332)

resetSize(x, y, width, height)

Reset the size and position of the physics body.

Parameters:
Name Type Description
x number

The x coordinate to position the body.

y number

The y coordinate to position the body.

width number

The width of the body.

height number

The height of the body.

Since: 3.0.0
Source: src/physics/impact/Body.js (Line 483)
Returns:

This Body object.

Type
Phaser.Physics.Impact.Body

skipHash()

[description]

Since: 3.0.0
Source: src/physics/impact/Body.js (Line 450)
Returns:

[description]

Type
boolean

toJSON()

[description]

Since: 3.0.0
Source: src/physics/impact/Body.js (Line 506)
Returns:

[description]

Type
JSONImpactBody

touches(other)

[description]

Parameters:
Name Type Description
other Phaser.Physics.Impact.Body

[description]

Since: 3.0.0
Source: src/physics/impact/Body.js (Line 463)
Returns:

[description]

Type
boolean

update(delta)

[description]

Parameters:
Name Type Description
delta number

The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate.

Since: 3.0.0
Source: src/physics/impact/Body.js (Line 365)

willDrawDebug()

[description]

Since: 3.0.0
Source: src/physics/impact/Body.js (Line 437)
Returns:

[description]

Type
boolean