animation problem

BlitzPlus Forums/BlitzPlus Beginners Area/animation problem

morcar(Posted 2013) [#1]
I wrote a small animation demo just to show me how it all works and yet i cant get it to run.

When I run it I have the error of invalid image handle.

Here is my code and the animation has 4 frames

;set resolution
Graphics 600,480,16,2

;create game timer
timer = CreateTimer(10)

;display all images from the centre
AutoMidHandle True

;load image as animation
img_man=LoadAnimImage ("demo3.png",40,64,0,4)

;set up frames
frame = 0

;set up x
x=200
;setup drawing buffer
SetBuffer BackBuffer()

;start main loop
While Not KeyHit(1)
;clear screen
Cls
;draw image
DrawImage img_man,x,200,frame
;advnce animation frame
frame=frame+1
If frame=4 Then frame=0
;move image to the right by 5 pixels
x=x+5
;wait for game timer
WaitTimer timer
;flip buffers to show image on screen
Flip
;end main while loop
Wend
;end program
End


misth(Posted 2013) [#2]
It fails to load your image. Be sure the image is in the same folder with your code.

Cheers.