API Docs for: 0.1.1
Show:

Movimentation Class

Module: Joy.Behaviour

Built-in behaviour that have acceleration / friction / velocity control. May be appended to any DisplayObject, by DisplayObject#behave method.

Constructor

Movimentation

()

Example:

player = new Joy.DisplayObject(...);

// Append movimentation behaviour to DisplayObject
player.behave(Joy.Behaviour.Movimentation);

// Configure attributes
player.maxVelocity.x = 8;
player.acceleration.x = 2;
player.friction.x = 1;

Attributes

acceleration

Vector2d

Acceleration by frame, in pixels.

direction

Vector2d readonly

Normalized velocity vector, with values between -1 and 1.

friction

Vector2d

Friction for velocity.

maxVelocity

Vector2d

Default: Joy.Vector2d(500,500)

velocity

Vector2d readonly

Current object's velocity