Class: Space

rune.physics.Space()

The Space class contains static methods for collision handling of display objects. The logic behind the class consists of a modified version of the collision logic used by Adam Saltsman's Flixel engine. Collision is limited to the object's hitbox and therefore ignores the size of the object's graphic representation. Note that all class content is static, so the class never needs to be instantiated.

Constructor

new Space()

Creates a new instance of the Space class.
Source:

Members

(static, constant) ANY :number

Bit field indicating any, or all orthogonal directions.
Type:
  • number
Default Value:
  • 0x1111
Source:

(static, constant) DOWN :number

Bit field indicating the orthogonal direction down.
Type:
  • number
Default Value:
  • 0x1000
Source:

(static, constant) LEFT :number

Bit field indicating the orthogonal direction left.
Type:
  • number
Default Value:
  • 0x0001
Source:

(static, constant) NONE :number

Indicates no direction.
Type:
  • number
Default Value:
  • 0x0000
Source:

(static, constant) RIGHT :number

Bit field indicating the orthogonal direction right.
Type:
  • number
Default Value:
  • 0x0010
Source:

(static, constant) UP :number

Bit field indicating the orthogonal direction up.
Type:
  • number
Default Value:
  • 0x0100
Source:

Methods

(static) separate(obj1, obj2) → {boolean}

Resolves collision between two objects based on their physical properties. The objects are separated in both x and y directions.
Parameters:
Name Type Description
obj1 rune.display.InteractiveObject The first object.
obj2 rune.display.InteractiveObject The second object.
Source:
Returns:
If the objects were separated.
Type
boolean

(static) separateX(obj1, obj2) → {boolean}

Resolves collision between two objects, but only in x direction. The y coordinates of the objects will not change.
Parameters:
Name Type Description
obj1 rune.display.InteractiveObject The first object.
obj2 rune.display.InteractiveObject obj2 The second object.
Source:
Returns:
If the objects were separated.
Type
boolean

(static) separateY(obj1, obj2) → {boolean}

Resolves collision between two objects, but only in y direction. The x coordinates of the objects will not change.
Parameters:
Name Type Description
obj1 rune.display.InteractiveObject The first object.
obj2 rune.display.InteractiveObject The second object.
Source:
Returns:
If the objects were separated.
Type
boolean