TNT Basic Forums > Feedback
Mod Functionality
< Last Thread     Next Thread >
Thread        Post A Reply

12-14-2001 03:38

Posted by:

Find more posts 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.


12-14-2001 09:56

Posted by:
John Treece-Birch

Find more posts by John Treece-Birch

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.


All times are GMT        Post A Reply

Forum Jump:
< Last Thread     Next Thread >

< Contact Us - TNT Basic >

Powered by: vBulletin Lite Version 1.0.1 Lite
Copyright © Jelsoft Enterprises Limited 2000.