A newbie question

Blitz3D Forums/Blitz3D Beginners Area/A newbie question

I would store your images in an array and then have a 'direction' variable that keeps track of which one to show.

Set up your images like this:

Dim t(3)
Global dir=0

t(0)=LoadImage("t0.bmp")
t(1)=LoadImage("t1.bmp")
t(2)=LoadImage("t2.bmp")
t(3)=LoadImage("t3.bmp")


Then when checking for the rotation key, just add 1 to dir and check if it's higher than 3. If so, reset it to 0...

If KeyHit(200) Then
  dir=dir+1
  If dir>3 Then dir=0
EndIf


The above can also be made a lot shorter by the use of the Mod operator.

If KeyHit(200) Then dir=(dir+1) Mod 4


Hope that helps.