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 20)

Members


accel :Phaser.Types.Math.Vector2Like

[description]

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

accelAir :number

[description]

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

accelGround :number

[description]

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

bounciness :number

[description]

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

checkAgainst :Phaser.Physics.Impact.TYPE

[description]

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

collides :Phaser.Physics.Impact.COLLIDES

[description]

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

debugBodyColor :integer

[description]

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

debugShowBody :boolean

[description]

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

debugShowVelocity :boolean

[description]

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

enabled :boolean

[description]

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

friction :Phaser.Types.Math.Vector2Like

[description]

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

gameObject :Phaser.GameObjects.GameObject

[description]

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

gravityFactor :number

[description]

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

id :integer

[description]

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

jumpSpeed :number

[description]

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

last :Phaser.Types.Math.Vector2Like

[description]

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

maxVel :Phaser.Types.Math.Vector2Like

[description]

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

minBounceVelocity :number

[description]

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

name :string

[description]

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

offset :Phaser.Types.Math.Vector2Like

[description]

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

<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 74)

pos :Phaser.Types.Math.Vector2Like

[description]

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

size :Phaser.Types.Math.Vector2Like

[description]

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

slopeStanding :Object

min 44 deg, max 136 deg

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

standing :boolean

[description]

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

type :Phaser.Physics.Impact.TYPE

[description]

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

<nullable> updateCallback :Phaser.Types.Physics.Impact.BodyUpdateCallback

[description]

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

vel :Phaser.Types.Math.Vector2Like

[description]

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

world :Phaser.Physics.Impact.World

[description]

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

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 530)

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 542)

destroy()

[description]

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

drawDebug(graphic)

[description]

Parameters:
Name Type Description
graphic Phaser.GameObjects.Graphics

[description]

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

fromJSON(config)

[description]

Parameters:
Name Type Description
config object

[description]

Since: 3.0.0
Source: src/physics/impact/Body.js (Line 517)
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 559)
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 314)

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 465)
Returns:

This Body object.

Type
Phaser.Physics.Impact.Body

skipHash()

[description]

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

[description]

Type
boolean

toJSON()

Export this body object to JSON.

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

JSON representation of this body object.

Type
Phaser.Types.Physics.Impact.JSONImpactBody

touches(other)

Determines whether the body collides with the other one or not.

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

[description]

Since: 3.0.0
Source: src/physics/impact/Body.js (Line 445)
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 347)

willDrawDebug()

[description]

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

[description]

Type
boolean