Math

Math

Methods


math_deg_to_rad(degrees)


Converts the given degrees to radians and returns the result.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
degrees Number

the number of degrees to convert to radians.

Code Equivalent:
game.math.degToRad(degrees)

math_rad_to_deg(radians)


Converts the given radians to degrees and returns the result.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
radians Number

the number of radians to convert to degrees

Code Equivalent:
game.math.radToDeg(radians)

phaser_easing(ease, direction)


Returns the chosen easing method in the given direction.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
ease

easing method to return

direction

direction for the easing method to use

Code Equivalent:
Phaser.ease.direction

phaser_easing_linear()

Code Equivalent:
Phaser.Easing.Linear.None

phaser_game_add_tween_from(target, duration, ease, autostart, delay, repeat, yoyo, properties)


Creates and returns a tween with the given properties. It will set the target to the destination value and tween to it's current value.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
target

the object to add the tween to

duration Number

duration of the tween

ease

the easing function to use on the tween

autostart Boolean

option to automatically start the tween instead of manually calling tween.start()

delay Number

delay before the tween will start, in milliseconds

repeat Number

how many times the tween should repeat. Set to -1 to run forever

yoyo Boolean

option for the tween to reverse itself and play backwards

properties

(optional) optional properties to add to the tween

Code Equivalent:
game.add.tween(target).from(objectProperties, duration, ease, autostart, delay, repeat, yoyo)

phaser_game_add_tween_to(target, duration, ease, autostart, delay, repeat, yoyo, properties)


Creates and returns a tween with the given properties. It will start at the current value and tween to the destination value.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
target

the object to add the tween to

duration Number

duration of the tween

ease

the easing function to use on the tween

autostart Boolean

option to automatically start the tween instead of manually calling tween.start()

delay Number

delay before the tween will start, in milliseconds

repeat Number

how many times the tween should repeat. Set to -1 to run forever

yoyo Boolean

option for the tween to reverse itself and play backwards

properties

(optional) optional properties to add to the tween

Code Equivalent:
game.add.tween(target).to(objectProperties, duration, ease, autostart, delay, repeat, yoyo)

phaser_resume_tween(tween)

Parameters:
Name Type Description
tween

tween to resume

Code Equivalent:
tween.resume();

phaser_start_tween(tween)

Parameters:
Name Type Description
tween

tween to start

Code Equivalent:
tween.start();

phaser_stop_tween(tween, complete)

Parameters:
Name Type Description
tween

tween to stop

complete Boolean

if true, dispatches the onComplete signal

Code Equivalent:
tween.stop(complete);

phaser_yoyo_tween(tween, enable, delay, index)


Make the chosen tween run through the starting values and then play back in reverse.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
tween

tween to yoyo

enable Boolean

enable/disable yoyoing on the tween

delay Number

the amount of time to wait until the yoyo will start

index Number

choose the object index on the tween to apply this to

Code Equivalent:
tween.yoyo(enable, delay, index);