|
Post by PeterMaria on Apr 6, 2016 9:01:04 GMT -5
Hello, TextMode(TEXT_BUFFERED) ResizeSpriteArea(640,480)
Sub SprSetAnimate(nr(),x,y,w,h,frame) NewSprite(nr) SprSetxCentre(.5):SprSetyCentre(.5) SprSetSize(w,h) SprSetPos(x,y) SprSetFrame(frame) End Sub
Function Rand(min,max) Return rnd()% (max - min + 1) + min End Function
dim h(15) = loadimageStrip("png/bat.png",32) dim x(4),y(4),z(4),c(4),t(4),f(4),i,v# x(0)=0 : y(0)=16 x(1)=60 : y(1)=16 x(2)=120 : y(2)=16 x(3)=180 : y(3)=16
for i=0 to 3 f(i) = rnd()%15 next
while ScankeyDown(27)=0 for i=0 to 3 if z(i)=0 then x(i)=x(i)+1 if x(i) >=620 then z(i)=1: endif endif next
for i=0 to 3 if z(i)=1 then y(i)=y(i)+1 t(i)=t(i)+1 if t(i)=40 then t(i)=0 z(i)=2 endif endif next
for i=0 to 3 if z(i)=2 then x(i)=x(i)+1*(-1) if x(i) <=20 then z(i)=3: endif endif next for i=0 to 3 if z(i)=3 then y(i)=y(i)+1 t(i)=t(i)+1 if t(i)=40 then t(i)=0 z(i)=0 endif if y(i)>=440 then z(i)=4: endif endif next
for i=0 to 3 if z(i)=4 then y(i)=y(i)-1 if y(i)=32 then z(i)=0 t(i)=0 endif endif next SprSetAnimate(h,x(0),y(0),64,64,f(0)) SprSetAnimate(h,x(1),y(1),64,64,f(1)) SprSetAnimate(h,x(2),y(2),64,64,f(2)) SprSetAnimate(h,x(3),y(3),64,64,f(3))
v#=v#+.1 if v# >1 then v#=0 for i=0 to 3 f(i) = f(i)+1 if f(i)=16 then f(i)=0: endif next endif DrawText() waittimer(8) ClearSprites() wend
Attachments:png.zip (14.66 KB)
|
|
|
BatMan
Apr 18, 2016 9:38:44 GMT -5
Post by matthew on Apr 18, 2016 9:38:44 GMT -5
Looks a bit like Space Invaders, Peter. :-)
|
|