-- Animation Sprites
-- Use this function to perform your initial setup
function setup()
coordx={0,64,128,192,297,0,105,210,274,338}
coordy={128,128,128,128,128,0,0,0,0,0}
largeur={64,64,64,100,100,100,100,64,64,64}
maxspr=10
sprites={}
chargeimage=false
continue=false
print("Wait please loading Image from Http...")
http.request("http://img24.imageshack.us/img24/4205/1359677950595.jpg",didGetImage)
-------------------------- Thank West -------------------------------------------
anim=1--a flag to state the current sprite image
animmax=maxspr -- the number of sprite images
animcount=1--a counter for the delay between swapping images
iparameter("animdelay",1,531,65) -- the length of delay hence speed of animation
end
-- This function gets called once every frame
function draw()
background()
if chargeimage then
print("Load completed...")
for i=1,maxspr do
sprites[i]=matrice:copy(coordx[i],coordy[i],largeur[i],124)
end
continue=true
chargeimage=false
end
if continue then
for i=1,maxspr do
if anim==i then
w,h=spriteSize(sprites[i])
sprite(sprites[i],WIDTH/2,130,w*2,h*2)
end
animcount = animcount + 1
if animcount>animdelay then
anim = anim + 1
animcount=0
end
if anim>animmax then
anim=1
end
end
end
end
function didGetImage(image)
matrice=image
print(matrice)
if spriteSize(matrice)==0 then
print ("Download failure.....")
setup()
end
chargeimage=true
end
Thanks for this!
This is awesome! Thanks!