is velocity max or limit or range possible?
Posted: Tue Dec 25, 2007 6:24 pm
is velocity max or limit or range possible? cuz i make my guy walk, and he just keeps gettign faster and faster
Game Editor discussion board
http://game-editor.com/forum/
xvelocity = xvelocity % 11;
xvelocity = xvelocity & 8;
Fuzzy wrote:Its the MOD operator. it divides var by 10 and chucks the quotient away and keeps the remainder. since the remainder has to be between 0 and 10, you get the range you want.
Actually I should have said
- Code: Select all
xvelocity = xvelocity % 11;
If you are willing to restrict to certain values you can do it another way.
- Code: Select all
xvelocity = xvelocity & 8;
1,2,4,8,16,32... is the sequence. Its even faster than %.
xvelocity -= (int)xvelocity % 11;