12142001 03:38
Posted by:
Socrates

The Mod function would be more useful if it behaved differently with regard to negative values. i.e...
Mod (1,8) should give 7 instead of 1
Mod (2,8) should give 6, etc
I'm using it to correct the angle value for a tank as it turns round. The left/right controls add or subtract 1 from the angle, and the mod function wraps this around so the values are always in the range 0 to 7 (the tank is drawn from 8 angles)
I know this is different from the meaning as it is currently defined (the remainder from integer division), but it is the more useful function from a game programmers point of view. Perhaps an AMod function could be added (absolute modulus), or a Range function, or something similar.
S

12142001 09:56
Posted by:
John TreeceBirch

Mod Function
I don't particularly want to change the way the mod function works because I think it is correct the way it is at the moment.
You are right though that you often want a function to be able to just wrap the value to a range so we'll probably add a function to do that instead. Thanks for the suggestion.
John
