abs

Returns the absolute value of a value.

Syntax:

abs(val)


Argument Description
val The number to turn absolute.


Returns: Real


Description

This function returns the absolute value of the input argument, so if it's a positive value then it will remain the same, but if it's negative it will be multiplied by -1 to make it positive.


Example:

x += abs (x - mouse_x)

This will add an amount equal to the absolute value of the current x position of the instance and the mouse x position.


Back: Real Number Functions
Next: sign
© Copyright YoYo Games Ltd. 2018 All Rights Reserved