Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program Pingpong;
- uses crt;
- var
- x,y,color,kx,ky,i,pax:integer;
- klawiatura:char;
- koniec:boolean;
- label miejsce;
- procedure paletka();
- begin
- gotoxy(pax,25);write('===');
- if keypressed then
- begin
- klawiatura:=readkey;
- if klawiatura = #97 then
- begin
- if pax =1 then
- goto miejsce;
- pax:=pax-1;
- end;
- if klawiatura = #100 then
- begin
- if pax=77 then
- goto miejsce;
- pax:=pax+1;
- end;
- miejsce:
- end;
- end;
- procedure Pilka();
- begin
- textcolor(color);
- paletka();
- gotoxy(x,y);write('O');
- x:=x+kx;
- y:=y+ky;
- if x=80 then
- kx:=-1;
- if x=1 then
- kx:=1;
- if y=25 then
- ky:=-1;
- if y=5 then
- ky:=1;
- end;
- procedure plansza();
- begin
- for i:=1 to 80 do
- begin
- gotoxy(i,5);write('=');
- end;
- end;
- procedure odbicie();
- begin
- if y=25 then
- begin
- if (x<pax) or (x>pax+3) then
- koniec:= true;
- end;
- end;
- procedure koniecgry();
- begin
- if koniec = true then
- begin
- Gotoxy(45,8);write('Koniec Gry');
- end;
- end;
- begin
- x:=1;
- y:=5;
- color:=6;
- kx:=1;
- ky:=1;
- pax:=37;
- koniec:=false
- while koniec = false do
- begin
- clrscr;
- plansza();
- paletka();
- pilka();
- odbicie();
- delay(35);
- end;
- koniecgry();
- readkey;
- end.
Add Comment
Please, Sign In to add comment