da isser. is noch die erste rohfassung, eigentlich wollte ich nur ein bisschen rumprobieren, so selbststudium, aber dann is das spiel draus geworden...wird noch verschönert
PROGRAM catchit;
uses crt;
VAR modus, maximum, moduszaehler, anzahlgefallen, punkte, xcoor, ycoor, xcoorP, ycoorP :integer;
taste :char;
PROCEDURE begruessung;
BEGIN
write('Welchen Modus wollen sie spielen? 1=Punktmodus, 2=Gefallenmodus, 3=Beenden.');
readln(modus);
IF modus = 1 THEN
BEGIN
write('maximale zahl an punkten/gefallenen teilen: ');
readln(maximum);
END;
IF modus = 2 THEN
BEGIN
write('maximale zahl an punkten/gefallenen teilen: ');
readln(maximum);
END
END;
PROCEDURE playermovement;
BEGIN
taste:=readkey;
CASE taste OF
#75 : BEGIN
IF xcoorP > 1 THEN
BEGIN
xcoorP := xcoorP-1;
END;
END;
#77 : BEGIN
IF xcoorP < 79 THEN
BEGIN
xcoorP := xcoorP+1;
END;
END;
#72 : BEGIN
IF ycoorP > 1 THEN
BEGIN
ycoorP := ycoorP-1;
END;
END;
#80 : BEGIN
IF ycoorP < 25 THEN
BEGIN
ycoorP := ycoorP+1;
END;
END;
END;
END;
PROCEDURE punktzaehler;
BEGIN
IF (xcoor=xcoorP) AND (ycoor=ycoorP) THEN
BEGIN
CASE ycoorP OF
1..5 : punkte := punkte+5;
6..10 : punkte := punkte+4;
11..15 : punkte := punkte+3;
16..20 : punkte := punkte+2;
21..25 : punkte := punkte+1;
END;
END;
END;
PROCEDURE itemrain;
BEGIN
REPEAT
BEGIN
RANDOMIZE;
ycoor := 1;
xcoor := RANDOM(79);
REPEAT
BEGIN
WHILE keypressed DO
BEGIN
playermovement;
END;
ClrScr;
Inc(ycoor);
GOTOXY(xcoor,ycoor);
write('0');
GOTOXY(xcoor,ycoor);
GOTOXY(xcoorP,ycoorP);
write('A');
GOTOXY(1,1);
writeln('Punkte: ',punkte,'');
write('gefallene Teile: ',anzahlgefallen,'');
DELAY(150);
{ICH VERMUTE DAS ES WAS HIERMIT ZU TUN HAT, ABER DIE FRAGE IST WARUM DAS FLIMMERN HOCHFREQUENTER WIRD WENN EINE TASTE GEDRÜCKT IST}
END;
UNTIL (ycoor = 25) OR (taste = #27) OR ((xcoor=xcoorP) AND (ycoor=ycoorP));
Inc(anzahlgefallen);
punktzaehler;
IF modus = 1 THEN
BEGIN
moduszaehler := punkte;
END;
IF modus = 2 THEN
BEGIN
moduszaehler := anzahlgefallen;
END;
END;
UNTIL (taste = #27) OR (moduszaehler = maximum);
END;
PROCEDURE ergebnis;
BEGIN
ClrScr;
IF taste = #27 THEN
BEGIN
writeln('vorzeitiger abbruch. ',punkte,' Punkte bei ',anzahlgefallen,' gefallenen teilen');
END;
IF moduszaehler = maximum THEN
BEGIN
write('Spiel vorber. ',punkte,' Punkte bei ',anzahlgefallen,' gefallenen Teilen');
END;
readkey;
END;
BEGIN
REPEAT
BEGIN
ClrScr;
xcoorP := 40;
ycoorP := 25;
begruessung;
taste := '0';
CASE modus OF
1 : BEGIN
itemrain;
ergebnis;
END;
2 : BEGIN
itemrain;
ergebnis;
END;
END;
END;
UNTIL modus = 3;
write('Programmed by IC3pickel');
readkey;
END.