TIMER:
Shape2.left:=Shape2.left+SpeedX;Shape2.top:=Shape2.top+speedY;if (Shape2.top<0) then speedY:=-speedY;If (Shape2.left<=0) or (Shape2.left + Shape2.width >= clientwidth) then speedX:=-speedX;if Shape2.top + Shape2.height >= clientheight then GameOver;if (Shape2.left+Shape2.width >= Shape1.left) and (Shape2.left <= Shape1.left+Shape1.width)and (Shape2.top+Shape2.Height>= Shape1.top) thenbeginspeedY:=-speedY;IncSpeed;Score:=Score+1;Label1.caption:='Score: '+IntToStr(Score);end; |
INIT
Score:=0;Label1.caption:='Score: '+IntToStr(Score);SpeedX:=4;SpeedY:=4;Label2.visible:=false;Label3.visible:=false;Shape2.top:=10;Shape2.left:=10;Timer1.enabled:=true; |