Sprites created from a GIF (Release Announcements)

by Jim ⌂ @, Russell, KY, Friday, February 21, 2014, 17:32 (1163 days ago) @ Hughze

here is an example - load the sprites however you want

# animatebox - simnple frame by brame sprite animation
# j.m.reneau 2014-02-21

clg
spritedim 4
global animateframe
animateframe = 0

color black
spritepoly 0, {0,0,100,0,100,100,0,100}
color darkred
spritepoly 1, {0,0,50,0, 50,40, 40,40, 40,60, 60,60, 60,40, 50,40, 50,0, 100,0, 100,100, 0,100}
color darkgreen
spritepoly 2, {0,0,50,0, 50,25, 25,25, 25,75, 75,75, 75,25, 50,25, 50,0, 100,0, 100,100, 0,100}
color darkblue
spritepoly 3, {0,0,50,0, 50,10, 10,10, 10,90, 90,90, 90,10, 50,10, 50,0, 100,0, 100,100, 0,100}


while true
call movebox(mousex, mousey)
call animatebox()
pause .02
end while


subroutine movebox(x,y)
# if we move one of then - move all of them

for t = 0 to 3
spriteplace t,x,y
next t
end subroutine

subroutine animatebox()
# every 200 ms do next frame
# show sprite 0, 1, 2, 3, 2, 1 then repeat
# animate frame just counts up from 0 now many frames we have done
if msec>=animateframe * 200 then
# for this frams which sprite should we show
sp = animateframe % 6
if sp > 3 then sp = 6-sp
# show it
spriteshow sp
# hide the others
for t = 0 to 3
if sp <> t then spritehide t
next t
animateframe++
endif
end subroutine


Complete thread:

 RSS Feed of thread

powered by my little forum