Physics

Module: engine.physics

Physics world.

new game.Physics([x], [y])

Parameters:

  • x Number (optional)

    Gravity x

  • y Number (optional)

    Gravity y

Properties

_collisionGroups Object

(No description yet)

bodies Array

List of bodies in world.

gravity Vector (Default: 0,980)

Gravity of physics world.

Methods

_addBodyCollision(body)

(No description yet)

Parameters:

  • body Body
_collide(body)

(No description yet)

Parameters:

  • body Body
_removeBodyCollision(body)

(No description yet)

Parameters:

  • body Body
_update()

(No description yet)

_updateCollision()

(No description yet)

addBody(body)

Add body to world.

Parameters:

  • body Body
hitResponse(a, b) Boolean

Hit response a versus b.

Parameters:

  • a Body
  • b Body

Returns true, if body is moved.

hitTest(a, b) Boolean

Hit test a versus b.

Parameters:

  • a Body
  • b Body

return true, if bodies hit.

removeBody(body)

Remove body from world.

Parameters:

  • body Body