Cycle AnimImage frames using Mod

BlitzMax Forums/BlitzMax Programming/Cycle AnimImage frames using Mod

Russell(Posted 2006) [#1]
Ok, I know there's a way to cycle through AnimImage frames using Mod, so that when the highest frame is reached the result is 0..but I'll be damned if I can remember how it goes. It accomplishes the same thing as:
frame:+ 1
If frame = 8 Then frame = 0 ' Assuming frame count 0-7

but looks nicer and uses Mod somehow.

Can someone help me remember this little tidbit? I couldn't find it in the code archives.

Thanks
Russell


TeaVirus(Posted 2006) [#2]
Local frames:Int=8
Local frame:Int=0

While True
	Print frame
	frame=(frame+1) Mod frames
Wend