Skip to main content

The "approx" Function


approx(value, min, [max]);
valuerealThe numerical value to check
minrealThe minimum closeness, or alternatively, minimum value to accept
[max]realOptional: The maximum value to accept (use none for +/- min)


Checks if a value is between two numbers and returns true or false.

By default, the input value will be tested plus or minus the min value, but an explicit max value can also be supplied to set the exact range.


if (approx(enemy.x - x, 128)) {
//Enemy is near player on left or right