Mógł by mi ktoś sprawdzić projekt i powiedzieć dlaczego nie chce działać.. A jeśli koś potrafi to niech zrobi tak żeby zadziałał.. Bardzo pilne proszę o pomoc!!!
Oto projekt:
Program MyGame;
Uses CRT, GRAPH;
Var
c1,c2 : char;
belka_x, ptk : integer;
fail : boolean;
{pozycja kulki}
kier : shortint;
kulka_x, kulka_y : integer;
Procedure Grafika;
Var k:integer;
Begin
k:=detect;
InitGraph(k, k, '\BGI');
End;
Procedure RysujPlansze;
Begin
Rectangle(20, 20, 400, 300);
End;
Procedure Belka(x:shortint);
Begin
{ wymaz wczesniejsza belke }
SetColor(0);
Line(21, 290, 399, 290);
{ pozycja belki }
if x=0 then
belka_x := 25
else
belka_x := belka_x + x;
{ granice belki }
if belka_x<21 then belka_x := 21;
if belka_x>379 then belka_x := 379;
{ rysunek }
SetColor(12);
Line(belka_x, 290, belka_x + 20, 290);
End;
Procedure LicznikPunktow;
Var result : string;
Begin
if ptk<0 then ptk:=0;
{Wymaz wczesniejsze pole}
SetColor(0);
SetFillStyle(1, 0);
Bar(412, 22, 462, 52);
{ utworz string z wynikiem }
Str(ptk, result);
SetColor(15);
Rectangle(410, 20, 460, 50);
OutTextXY(413, 24, 'WYNIK:');
OutTextXY(430, 40, result);
End;
Procedure Kulka;
Var x,y : word;
Begin
{Wymaz wczesniejsze pole}
SetColor(0);
SetFillStyle(1, 0);
Bar(21, 21, 399, 289);
{Losuj polozenie kulki}
Randomize;
x := Random(358);
{Rysuj kulke}
SetColor(12);
Circle(x+22, 40, 3);
kulka_x := x+23;
kulka_y := 40;
End;
Procedure LatajacaKulka;
Var tempo:integer;
Begin
if KeyPressed then Begin
{sterowanie}
c1 := ReadKey;
if c1=chr(0) then c2 := ReadKey;
if c2='M' then Belka(5);
if c2='K' then Belka(-5);
end else Begin
if fail=true then exit;
{Wymaz wczesniejsze pole}
SetColor(0);
SetFillStyle(1, 0);
Bar(21, 21, 399, 289);
{Zwieksz poziom trudnosci z czasem}
if ptk<5 then tempo := 1
else if ptk<10 then tempo := 2
else if ptk<15 then tempo := 3
else if ptk<20 then tempo := 4
else if ptk<30 then tempo := 5
else if ptk<40 then tempo := 6
else if ptk<50 then tempo := 7
else tempo := 10;
{Nowa pozycja kulki}
kulka_x := kulka_x;
kulka_y := kulka_y + tempo;
{Rysuj kulke}
SetColor(12);
Circle(kulka_x, kulka_y, 3);
if (kulka_y < 285) AND (kulka_y >= 283) then begin
{Exit;}
end;
Delay(50);
end;
End;
Procedure EndGame;
Var str_result : string;
Begin
{Wymaz wczesniejsze pole}
SetColor(0);
SetFillStyle(1, 0);
Bar(21, 21, 399, 289);
Str(ptk, str_result);
{Game over}
SetColor(15);
OutTextXY(140, 150, 'Koniec gry.');
OutTextXY(140, 170, 'Uzyskany wynik:');
SetColor(12);
OutTextXY(140, 180, str_result);
SetColor(15);
OutTextXY(160, 180, 'ptk');
{dzwiek}
Sound(400);
Delay(500);
NoSound;
{Zakonczenie programu}
Readln;
End;
Begin
fail := false;
{grafika + czystka}
Grafika;
ClearDevice;
{opakowanie gry}
RysujPlansze;
Belka(0);
LicznikPunktow;
{latajaca pileczka}
Kulka;
Repeat
{latajaca kulka}
LatajacaKulka;
if (kulka_y < 285) AND (kulka_y >= 283) then begin
if (belka_x+20 > kulka_x) AND (kulka_x >= belka_x) then begin
kulka_y := 40;
kulka_x := Random(358) + 23;
LatajacaKulka;
inc(ptk);
LicznikPunktow;
{dzwiek}
Sound(2200);
Delay(80);
NoSound;
end else begin
fail := true;
{EndGame;}
end;
end;
Until (c1=chr(27)) OR (fail=true);
EndGame;
End.