Class: Body

physics~Body()

A physics body that can be added to game objects.

Constructor

new Body()

Source:

Members

allowGravity :boolean

Wether the body is influenced by the world's gravitational forces.
Type:
  • boolean
Default Value:
  • false
Source:

blocked :object

Use this to check wether this body is blocked on certain sides by immovable bodies. {none, top, right, bottom, left}
Type:
  • object
Source:

bottom :number

The bottom y position of the body.
Type:
  • number
Source:

collideWorldBounds :boolean

Wether this body collides with the world bounds.
Type:
  • boolean
Default Value:
  • false
Source:

frictionX :number

How much of this body's velocity is transferred to colliding bodies along the cross x-axis.
Type:
  • number
Default Value:
  • 0
Source:

frictionY :number

How much of this body's velocity is transferred to colliding bodies along the cross y-axis.
Type:
  • number
Default Value:
  • 0
Source:

height :number

The height of the body.
Type:
  • number
Source:

immovable :boolean

Wether the body is not displaced by collisions.
Type:
  • boolean
Default Value:
  • true
Source:

left :number

The left x position of the body.
Type:
  • number
Source:

midX :number

The mid x position of the body.
Type:
  • number
Source:

midY :number

The mid y position of the body.
Type:
  • number
Source:

restitution :boolean

How much other bodies bounce off of this body. 0 means no bounce. 1 means the other bodies velocity is completly reversed.
Type:
  • boolean
Default Value:
  • 0
Source:
The right x position of the body.
Type:
  • number
Source:

top :number

The top y position of the body.
Type:
  • number
Source:

touching :object

Use this to check wether this body is touching any movable bodies on certain sides. {none, top, right, bottom, left}
Type:
  • object
Source:

vx :number

The velocity of the body along the x-axis.
Type:
  • number
Default Value:
  • 0
Source:

vy :number

The velocity of the body along the y-axis.
Type:
  • number
Default Value:
  • 0
Source:

width :number

The width of the body.
Type:
  • number
Source:

x :number

The left x position of the body.
Type:
  • number
Source:

y :number

The top y position of the body.
Type:
  • number
Source: