Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / Sprite Animation (looping)

Author
Message
CRubbish
20
Years of Service
User Offline
Joined: 11th Feb 2004
Location:
Posted: 12th Feb 2004 05:16
I need to figure out how i can loop this sprite animation between 2 frames for a few seconds then make it stop. Had no luck so far. If you have any advice at all feel free to post. thanks.

Phil 3:7-11
CRubbish
20
Years of Service
User Offline
Joined: 11th Feb 2004
Location:
Posted: 12th Feb 2004 05:38
ignore that piece at the end of the cod that says

"if timer()+time=10000 then exit"

that was just one of my tries that failed, sorry for any confusion that caused

Phil 3:7-11
CRubbish
20
Years of Service
User Offline
Joined: 11th Feb 2004
Location:
Posted: 12th Feb 2004 06:42
ok i figured it out;

you hafta add time=timer() before "do"
then add if timer()-time>= 7000 then exit

its hard to explain but it works



load bitmap "officers.bmp",1


get image 1,2,2,100,120
get image 2,126,2,225,120


sprx=450
spry=200
frame=1
sprite 1,sprx,spry,frame
show sprite 1

stretch sprite 1,200,200

sync on
sync rate 0

tick=timer()+100
frame=1
sprite 1,sprx,spry,frame

time=timer()

do

if timer()>=tick
tick=tick+100
if frame=2
frame=1
else
inc frame
endif
sprite 1,sprx,spry,frame

if timer()-time>=7000 then exit
endif
sync
loop


Phil 3:7-11

Login to post a reply

Server time is: 2024-05-13 10:40:46
Your offset time is: 2024-05-13 10:40:46