Class: Force

Force

new gdjs.Force(x, y, multiplier)

A vector used to move objects.

Name Type Description
x number

The initial x component

y number

The initial y component

multiplier number

The multiplier (0 for a force that disappear on next frame, 1 for a permanent force)

Methods

getAngle()

Get the angle of the force

getLength()

Get the length of the force

getMultiplier(){number}

Return 1 (true) if the force is permanent, 0 (false) if it is instant.

Returns:
Type Description
number

getX()

Returns the X component of the force.

getY()

Returns the Y component of the force.

setAngle(angle)

Set the angle of the force.

Name Type Description
angle number

The new angle

setLength(len)

Set the length of the force.

Name Type Description
len number

The length

setMultiplier(multiplier)

Set if the force multiplier.

Name Type Description
multiplier number

The new value

setX(x)

Set the x component of the force.

Name Type Description
x number

The new X component

setY(y)

Set the y component of the force.

Name Type Description
y number

The new Y component