/* やったー 避けゲーできたよ! */

#define N 256
#define WA 15;←FPS=60になるよう、ウェイトを調節してください。
dim f,N:dim x,N:dim y,N:dim dx,N:dim dy,N:mx=100:my=170:e=0:randomize
title "避けゲー":screen ,200,200,,dispx-200/2,dispy-200/2:font"MS 明朝",13
*main
mc++:m=mc/20+10:sc=mc/60:redraw 0:if m>N{m=N}color 0,0,0:boxf 0,0,200,200
color 255,128,128:s=0:repeat N:l=cnt:if f.l=0{if s<m{f.l=1:rnd x.l,20000
y.l=0:rnd dx.l,80:rnd dy.l,90:dx.l-=40:dy.l+=40}else{continue}}s++:x.l+=dx.l
y.l+=dy.l:tx=x.l/100:ty=y.l/100:if tx<0|(200<tx)|(ty<0)|(200<ty):f.l=0
boxf tx,ty,tx+1,ty+1:loop:a=mx:b=my:stick k,15:if k&1{mx-}if k&2{my-}
if k&4{mx+}if k&8{my+}if mx<=0|(200<=mx)|(my<=0)|(200<=my):mx=a:my=b
pget mx,my:if gval=128{e=1}color 255,255,255:boxf mx-1,my-1,mx+1,my+1
pos 4,4:mes"秒:"+sc+" 弾数:"+s+" FPS="+gfp:redraw:await WA:if e{goto *en}
fp++:gettime t,6:if t!=tt{gfp=fp:fp=0}tt=t:goto *main
*en
wait 50:color 0,60,100:boxf 0,76,200,124:pos 4,80:color 255,160,160
mes"死亡\n記録:"+sc+"秒"+"(FPS=60のとき)\nby ゆうき":redraw:stop