Advertisement
Guest User

Untitled

a guest
May 23rd, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. uses ABCobjects, Events, Timers;
  2.  
  3. var P: RoundRectABC;
  4. B: CircleABC;
  5. T: Timer;
  6. X,Y,A: integer;
  7.  
  8. Procedure KeyDown(key: integer);
  9. begin
  10. Case key of
  11. VK_Left: P.MoveOn(-15,0);
  12. VK_Right: P.MoveOn(15,0);
  13. VK_Space: if T.Enabled then T.Stop else T.Start;
  14. end;
  15. if P.Left<0 then P.Left:=0;
  16. if P.Left>WindowWidth-P.Width then P.Left:=WindowWidth-P.Width;
  17.  
  18. end;
  19.  
  20.  
  21. Procedure Pause;
  22. begin
  23. B.MoveOn(x,y);
  24. if (B.Left<0) or (B.Left>WindowWidth-B.Width) then X:=-X;
  25. if B.Top<0 then Y:=-Y;
  26. if B.Intersect(P) then
  27. begin
  28. Y:=-Y;
  29. if X>0 then X:=random
  30. end;
  31. end;
  32.  
  33.  
  34. begin
  35. P:=RoundRectABC.Create(0,0,120,15,15,clRandom);
  36. B:=Circleabc.create(0,0,20,clRandom);
  37. T:=Timer.Create(20,Pause);
  38. T.Stop; // Âûêëþ÷àåì Òàéìåð  Íà÷÷àëå
  39. P.Left:=WindowWidth div 2 - P.Width div 2;
  40. P.Top:=WindowHeight - 50;
  41. B.Left:=WindowWidth div 2 - B.Width div 2;
  42. B.Top:=P.Top-20;
  43. Y:=-15;
  44. X:=random(10)+1;
  45. A:=Random(2);
  46. onKeyDown:=KeyDown;
  47. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement