2 アニメーション

DynamicModule[{shipX=0,rocks={},t=0,gameOver=False,running=False,score=0,countdown=3,countdownStart=0,mouseX=0},Column[{Row[{Button["▶ Start",If[!running&&!gameOver,countdown=3;
countdownStart=AbsoluteTime[];
running="countdown"],Enabled->Dynamic[!running&&!gameOver]],Button["🔁 Reset",(shipX=0;rocks={};t=0;score=0;gameOver=False;
running=False;countdown=3;countdownStart=0;)]}],Dynamic[Module[{elapsed,displayText=""},If[running==="countdown",elapsed=Floor[AbsoluteTime[]-countdownStart];
countdown=Max[3-elapsed,0];
If[countdown<=0,running=True];
displayText=ToString[countdown]];
If[!running&&!gameOver,displayText="Press ▶ to Start"];
If[running===True&&!gameOver,t++;
If[Mod[t,9]==0,rocks=Append[rocks,{RandomReal[{-10,10}],10}]];
rocks=Select[rocks,#[[2]]>-11&];
rocks=(#-{0,0.15}&)/@rocks;
shipX=Clip[mouseX,{-9,9}];
If[Length[Select[rocks,Abs[#[[1]]-shipX]<1&&#[[2]]<-8.5&]]>0,gameOver=True;running=False,score++]];
EventHandler[Graphics[{Text[Style["SCORE: "<>ToString[score],14,White],{-9,9}],Blue,Disk[{shipX,-8.5},1],Red,Disk[#,0.5]&/@rocks,If[gameOver,Text[Style["GAME OVER",20,Red,Bold],{0,0}]],If[displayText=!="",Text[Style[displayText,30,Yellow,Bold],{0,0}]]},PlotRange->{{-10,10},{-10,10}},Background->Black,ImageSize->300],{"MouseMoved":>(mouseX=MousePosition["Graphics"][[1]]/. _Missing->shipX;)}]],UpdateInterval->0.1,TrackedSymbols:>{t,countdown,mouseX}]}]]