Module Handy maths for games
#include <macaw.h>
Functions
- rnd
- Gives a random number, for dice, enemy moves and anything else that should change each time.
- mid
- Gives the middle one of three numbers.
- clamp
- Keeps a number between two limits, like a player's position inside the screen.
- sgn
- Tells you whether a number is below 0, for things like which way something faces.
- lerp
- Finds the number part of the way from one number to another, for smooth movement and fades.
- flr
- Rounds a number down to a whole number, as
floor does: flr(2.7) is 2 and flr(-2.5) is -3.