Physics

Pixel~ Physics

Pixel physics class.

Constructor

new Physics(parent)

Source:
Creates a physics instance.
Parameters:
Name Type Description
parent Pixel.Stage The parent stage this physics runs off of.

Members

colliding :object

Source:
Holds date telling the user if the sprite is colliding.
Type:
  • object

collisions :Array.<object>

Source:
Stores all collision data.
Type:
  • Array.<object>

Methods

add(name, sprite1, sprite2)

Source:
Adds new collider.
Parameters:
Name Type Description
name string The name of the collision.
sprite1 Array.<Pixel.Sprite> | Array.<Pixel.Map> | Array.<Pixel.AnimatedSprite> The first sprite(s) that will collide with the second.
sprite2 Pixel.Sprite | Pixel.Map | Pixel.AnimatedSprite The second sprite that collides with the first.