Вот... раскопал, когда чистил свой хард от мусора. Писал когда учился программировать. Детство, да и только!
=================================
PROGRAM igra;
USES graph,CRT;
VAR Device,Mode,torped,podbit,x,y,a,b:integer;
imya,tor,pod:string;
kl,otv:char;
Procedure RISUNOK;forward;
Procedure NACHALO;forward;
{=============================================================}
PROCEDURE ZAVERSH;
BEGIN SetColor(Red);
case podbit of
0 :OutTextXY(200,200,'Very Bad');
1,2 :OutTextXY(200,200,'Not Very Good...');
9,10 :OutTextXY(200,200,'Excellent!!!');
else OutTextXY(200,200,'Good!');
end;
ReadLn;
ClearDevice;
OutTextXY(200,200,'Game Over!');
ReadLn;
CloseGraph;
halt;
END;
{=============================================================}
PROCEDURE POPAL;
BEGIN SetColor(white);
OutTextXY(200,100,'Hurra!');
torped:=torped-1;
podbit:=podbit+1;
ReadLn;
if torped<1 then ZAVERSH else risunok;
END;
{=============================================================}
PROCEDURE NE_POPAL;
BEGIN SetColor(white);
OutTextXY(200,100,':-(');
torped:=torped-1;
readLn;
if torped<1 then ZAVERSH else risunok;
ReadLn;
END;
{=============================================================}
PROCEDURE ATAKA;
BEGIN y:=480;
repeat
SetColor(white);
Ellipse(x,200,0,360,30,10);{korabl'}
setColor(black);
Ellipse(x,200,0,360,30,10);
x:=x+3;
SetColor(white);
line(0,200,640,200);
SetFillStyle(1,LightBlue);
FloodFill(x+2,198,White);
Ellipse(420,y,0,360,5,10);{torpeda}
Delay(5);
SetColor(black);
Ellipse(420,y,0,360,5,10);
SetFillStyle(1,blue);
FloodFill(416,y+4,white);
FloodFill(x+2,202,white);
y:=y-3;
until y<200;
if(x>400) and (x<440) then popal else ne_popal;
END;
{=============================================================}
PROCEDURE KORABL;
BEGIN
REPEAT
x:=40;
repeat
SetColor(white);
Ellipse(x,200,0,360,30,10);
randomize;
a:=random(15);
Delay (a);
setColor(black);
Ellipse(x,200,0,360,30,10);
x:=x+1;
SetColor(white);
line(0,200,640,200);
SetFillStyle(1,LightBlue);
FloodFill(x+2,198,White);
SetFillStyle(1,blue);
FloodFill(x+2,202,white);
If KeyPressed then begin
kl:=ReadKey;
if kl=' 'then ataka;
end{if};
until x>600;
x:=600;
repeat
SetColor(white);
Ellipse(x,200,0,360,30,10);
Delay (a);
setColor(black);
Ellipse(x,200,0,360,30,10);
x:=x-1;
SetColor(white);
line(0,200,600,200);
If KeyPressed then begin
kl:=ReadKey;
if kl=' 'then ataka;
End{if};
until x<20;
UNTIL 3<2;
END;
{============================================================}
PROCEDURE RISUNOK;
BEGIN ClearDevice;
Line(0,200,640,200);
Circle(450,50,30);
SetFillStyle(1,Yellow);
FloodFill(450,50,white);
SetFillStyle(1,Lightblue);
FloodFill(10,10,white);
SetFillStyle(1,Blue);
FloodFill(630,470,white);
SetTextStyle(4,0,4);
OutTextXY(10,10,imya);
Str(Torped,tor);
Str(Podbit,pod);
OutTextXY(10,40,'Rockets:');
OutTextXY(120,40,tor);
OutTextXY(10,70,'Kills:');
OutTextXY(100,70,pod);
rectangle(410,470,430,480);
KORABL;
END;
{===========================================================}
PROCEDURE NACHALO;
BEGIN ClearDevice;
SetColor(White);
Torped:=10;
Podbit:=0;
Write('Enter your name : ');
ReadLn(imya);
RISUNOK;
END;
{===========================================================}
BEGIN
Device:=0;
InitGraph(Device,Mode,'');
DirectVideo:=false;
NACHALO;
END.
ЗЫ: Простите что без единого комментария
Моя первая игрушка |