1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
|
uses crt,dos;
type t_enre = record
x,y :byte;
cor :string;
end;
const bouge='-----';
var i,j:integer;
plat,Obs:t_enre;
balle:array[1..100] of t_enre;
ch:char;
cp,relais:integer;
cptr:integer;
heure,minu,sec,cent,plus,chrono:Word;
tire:array[1..100] of boolean;
procedure deplace;
begin
ch:=readkey;
Case ord(ch) of
{Haut} 72:begin
Dec(plat.y);
gotoxy(plat.x,plat.y);
write(plat.cor);
gotoxy(plat.x,plat.y+1);
write(' ');
end;
{Bas} 80:begin
Inc(plat.y);
gotoxy(plat.x,plat.y);
write(plat.cor);
gotoxy(plat.x,plat.y-1);
write(' ');
end;
end;
end;
Procedure Obstacle;
var interm:word;
kiss:word;
begin
Repeat
if keypressed then
begin
ch:=readkey;
Case ord(ch) of
{Haut} 72:begin
Dec(plat.y);
gotoxy(plat.x,plat.y);
write(plat.cor);
gotoxy(plat.x,plat.y+1);
write(' ');
end;
{Bas} 80:begin
Inc(plat.y);
gotoxy(plat.x,plat.y);
write(plat.cor);
gotoxy(plat.x,plat.y-1);
write(' ');
end;
{entree}13:begin
gotoxy(1,1);write(cptr);
gotoxy(1,3);write(cp);
tire[cptr]:=true;
balle[cptr].x:=plat.x+5;
balle[cptr].y:=plat.y;
balle[cptr].cor:=' +';
inc(cptr);
end;
end;
end;
{ Temps visible au cours du jeu }
Gettime(heure,minu,sec,cent);
for i:=cptr downto 1 do
If (tire[i]=true) and (kiss<>cent) and (balle[i].x<=75) then
begin
Inc(balle[i].x);
Gotoxy(balle[i].x,balle[i].y);
write(balle[i].cor);
if balle[i].x=75 then
begin
gotoxy(balle[i].x,balle[i].y);write(' ');
INc(relais);
(*
for j:=2 to cptr-1 do
begin
balle[j-1].x:=balle[j].x;
balle[j-1].y:=balle[j].y;
end; *)
tire[i]:=false;
end;
end;
IF (plus<>sec) then
begin
Gotoxy(obs.x,obs.y);
write(' ');
dec(obs.x);
Gotoxy(obs.x,obs.y);
write(obs.cor);
end;
kiss:=cent;
plus:=sec;
(* GOTOXY(72,20);
Write(' ');
GOTOXY(72,20);
WRITE(chrono);
*)
Until ord(ch)=27;
end;
begin
clrscr;
relais:=1;
plat.x:=12;
plat.y:=12;
plat.cor:=bouge;
gotoxy(plat.x,plat.y);
write(plat.cor);
obs.x:=78;
obs.y:=12;
obs.cor:='o';
chrono:=123;
cptr:=1;
cp:=0;
for i:=1 to 100 do tire[i]:=false;
Repeat
Obstacle;
Until ord(ch)=27;
end. |
Partager