optimize 7; ;A little demo of moving things using the Blit command... ; the image.res must inlcude in compileroptions to use this functions WBStartup ;create a 'ball' type variable ; NEWTYPE.ball x.q y xs ys End NEWTYPE DEFTYPE.l ;dimension a 'List' of 'balls' Dim List balls.ball(250) !image_include !screen_ {0,"","ram:prefsfile",1}:If scr\id=0 Then End Window 0,0,0,scr\width,scr\height,$800,"",0,1 succ=image_load {1,"amiga1000.jpg"} succ=image_load {0,"ball.iff"} !screen_ {1,"","ram:prefsfile",0}:If scr\id=0 Then End ;a second screen for doublebuffer Window 1,0,0,scr\width,scr\height,$800,"",0,1 ;second window ;keep adding items to list until list full ; While AddLast(balls()) ;Delay_(1) ;for better rnd values on winuae balls()\x=Rnd(scr\width)-10,Rnd(scr\height)-10,(Rnd-.5)*20,(Rnd-.5)*20 Wend ;while mouse button not hit.. ; While Joyb(0)=0 ShowScreen num num+1 If num>1 Then num=0 Use Window num ;start at first item in list ; ResetList balls() ;WCls image_blitmask {1} ;draw background WLocate 10,40 If res<5 Then res=5 NPrint "fps ",50/(res LSR 2)," ",num ;wait for vertical blank ; ;Delay_(1) ;while more items to come... ; While NextItem(balls()) balls()\x+balls()\xs balls()\y+balls()\ys ;reverse direction if ball gets to edge of bitmap ; If balls()\x<10 OR balls()\x>scr\width Then balls()\xs=-balls()\xs If balls()\y<10 OR balls()\y>scr\height Then balls()\ys=-balls()\ys image_blitmask {0,balls()\x,balls()\y,1} ;draw balls Wend count+1 If count=4 Then count=0:res=Timer:ResetTimer Wend End ;important allow autofree