! Tile invaders Fn.def col() Fn.rtn 50+floor(rnd()*100) Fn.end Gr.open 255,0,0,0,0 !Tts.init GR.ORIENTATION 1 gr.set.antialias 1 GR.SCREEN w,h LIST.CREATE n,l LIST.CREATE n,lvx LIST.CREATE n,lvy GR.SET.STROKE pz GR.SET.ANTIALIAS 0 GR.RECT edge,0,h,w,h+100 Gr.rect gone,0,-100,w,0 boxh=h/20 boxw=w/4 rows=50 for i=1 to rows x=floor(rnd()*4) for j=0 to 3 if j=x gr.color 255,col(),col(),col() gr.rect b,j*boxw+10,i*boxh-boxh*rows,(j+1)*boxw-10,(i+1)*boxh-10-boxh*rows gr.show b list.add l,b list.add lvx,0 list.add lvy,1+rnd()*6 endif next next Hit=1 gr.rect missile,-21,h-20,-1,h gr.show missile do LIST.SIZE l,z:max = z for i=1 to z GR.TOUCH t,x,y if t & hit Hit=0 gr.modify missile,"left",x-50,"top",h-50,"right",x+50,"bottom",h gr.show missile Endif ii = i:LIST.GET l,ii,q LIST.GET lvx,ii,dx:LIST.GET lvy,ii,dy:GR.MOVE q,dx,dy If gr_collision(q,edge) Lose=1 F_n.break Endif If gr_collision(missile,gone) hit=1 Gr.hide missile Endif IF GR_COLLISION(missile,q) GR.HIDE q gr.hide missile hit=1:score++ !tts.speak int$(score),0 If score=rows then win=1 ENDIF next if !hit gr.move missile,0,-12 endif GR.RENDER UNTIL lose | win S$="sorry,you lost.\n" If win then s$="congratulations, you won!\n" Gr.close S$+= "your final score is "+int$(score) Print s$ !Tts.speak s$,1 Pause 3000 Exit