Beginnner to sprites : Basic help needed

BlitzMax Forums/BlitzMax Beginners Area/Beginnner to sprites : Basic help needed

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

This should do it:


Global x:int = 0

Global myanimation:TImage = LoadAnimImage("Ko1.png",32,32,0,5)

Repeat
  
  Cls

     DrawImage myanimation,50,50,x

     x:+1
     if x > 4 then x = 0

  Flip
  Flushmem

UntilKeyHit(KEY_ESCAPE)



Frames in the LoadAnimImage command start from 0 and go up to how many frames there actually is. So if there are 5 frames it goes from 0 to 5. DrawImage command on the other hand starts counting from 0 so 0 is a frame. So for 5 frames it would actually be 0 to 4.

Hope that helps :)