Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- uses ABCobjects, Events, Timers;
- var P: RoundRectABC;
- B: CircleABC;
- T: Timer;
- X,Y,A: integer;
- Procedure KeyDown(key: integer);
- begin
- Case key of
- VK_Left: P.MoveOn(-15,0);
- VK_Right: P.MoveOn(15,0);
- VK_Space: if T.Enabled then T.Stop else T.Start;
- end;
- if P.Left<0 then P.Left:=0;
- if P.Left>WindowWidth-P.Width then P.Left:=WindowWidth-P.Width;
- end;
- Procedure Pause;
- begin
- B.MoveOn(x,y);
- if (B.Left<0) or (B.Left>WindowWidth-B.Width) then X:=-X;
- if B.Top<0 then Y:=-Y;
- if B.Intersect(P) then
- begin
- Y:=-Y;
- if X>0 then X:=random
- end;
- end;
- begin
- P:=RoundRectABC.Create(0,0,120,15,15,clRandom);
- B:=Circleabc.create(0,0,20,clRandom);
- T:=Timer.Create(20,Pause);
- T.Stop; // Âûêëþ÷àåì Òàéìåð  Íà÷÷àëå
- P.Left:=WindowWidth div 2 - P.Width div 2;
- P.Top:=WindowHeight - 50;
- B.Left:=WindowWidth div 2 - B.Width div 2;
- B.Top:=P.Top-20;
- Y:=-15;
- X:=random(10)+1;
- A:=Random(2);
- onKeyDown:=KeyDown;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement