Advertisement
asmodeus94

samochodzik

May 23rd, 2012
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 1.32 KB | None | 0 0
  1. program grafika;
  2. uses GRAPH,CRT;
  3. var
  4. ster,tryb:integer;
  5. a:char;
  6. x,y,x2,y2:integer;
  7. wyszZa : byte;
  8. fillinfo:FillSettingsType;
  9. kolor : word;
  10. procedure plansza(ktora : byte);
  11. begin
  12. case ktora of
  13. 1: begin
  14.    ellipse(300,240,0,360,180,220);
  15.    ellipse(300,240,0,360,100,120);
  16.    setfillstyle(1,green);
  17.    floodfill(320,240,white);
  18.    floodfill(1,1,white);
  19.    line(120,240,200,240);
  20. end;
  21. end;
  22. end;
  23. procedure mozliwe(s,t : integer);
  24. var i,j : byte;
  25. begin i:=0;
  26. s:=x2-x-9;
  27. REPEAT
  28. i:=i+1;j:=0;t:=y2-y-9;
  29.        REPEAT
  30.        putpixel(s,t,12);
  31.        j:=j+1;t:=t+9;
  32.        UNTIL j=3;
  33. s:=s+9;
  34. UNTIL i=3;
  35. end;
  36. procedure all;
  37. begin
  38. x2:=160;
  39. y2:=240;
  40. repeat
  41. mozliwe(x2,y2);
  42. a:=readkey;
  43. case a of
  44. 'q':begin y:=y+10; x:=x+10; end;
  45. 'w':begin y:=y+10; end;
  46. 'e':begin y:=y+10; x:=x-10; end;
  47. 'a':begin x:=x+10; end;
  48. 's':begin y:=y+0; x:=x+0; end;
  49. 'd':begin x:=x-10; end;
  50. 'z':begin y:=y-10; x:=x+10; end;
  51. 'x':begin y:=y-10; end;
  52. 'c':begin y:=y-10; x:=x-10; end;
  53. end;
  54.  
  55. if getpixel(x2-x,y2-y)<>0 then
  56. begin wyszZa:=1; end;
  57. setlinestyle(dottedln,0,3);
  58. line(x2,y2,x2-x,y2-y);
  59. setlinestyle(0,0,1);
  60. x2:=x2-x;
  61. y2:=y2-y;
  62. if wyszZa=1 then begin
  63. x:=0; y:=0;
  64. wyszza:=0;
  65. end;
  66. circle(x2,y2,3);
  67. until a='b';
  68. end;
  69. Begin
  70. ster:=VGA;  tryb:=VGAHi;
  71. InitGraph(ster, tryb, 'd:\bgi');plansza(1);
  72. all;
  73. closegraph;
  74. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement