Версия для печати темы

Нажмите сюда для просмотра этой темы в обычном формате

Форум «Всё о Паскале» _ Написание игр _ БК

Автор: PAHKOP 27.05.2007 14:46

program bk;
uses crt;
var kr,i,xp1,xp2,hit1,hit2,blok1,blok2:byte; name,h1,h2,b1,b2:string; cursor:char;
begin
clrscr;
randomize;
textcolor(red);
write('Enter Your Name: ');
read(name);
i:=1;
kr:=1;
xp1:=10;
xp2:=10;
repeat;
repeat;
repeat;
if kr>2 then kr:=kr-2;
clrscr;
textcolor(yellow);
write(name,' ');
if xp1=10 then write('IIIIIIIIII')
else if xp1=9 then write('IIIIIIIII ')
else if xp1=8 then write('IIIIIIII ')
else if xp1=7 then write('IIIIIII ')
else if xp1=6 then write('IIIIII ')
else if xp1=5 then write('IIIII ')
else if xp1=4 then write('IIII ')
else if xp1=3 then write('III ')
else if xp1=2 then write('II ')
else if xp1=1 then write('I ');
write(' enemy ');
if xp2=10 then write('IIIIIIIIII')
else if xp2=9 then write('IIIIIIIII ')
else if xp2=8 then write('IIIIIIII ')
else if xp2=7 then write('IIIIIII ')
else if xp2=6 then write('IIIIII ')
else if xp2=5 then write('IIIII ')
else if xp2=4 then write('IIII ')
else if xp2=3 then write('III ')
else if xp2=2 then write('II ')
else if xp2=1 then write('I ');
writeln('');
if i=1 then textcolor(green) else textcolor(white);
if kr=1 then writeln('1. head hit');
if kr=2 then writeln('1. head blok');
if i=2 then textcolor(green) else textcolor(white);
if kr=1 then writeln('2. upper body hit');
if kr=2 then writeln('2. upper body blok');
if i=3 then textcolor(green) else textcolor(white);
if kr=1 then writeln('3. lower body hit');
if kr=2 then writeln('3. lower body blok');
if i=4 then textcolor(green) else textcolor(white);
if kr=1 then writeln('4. legs hit');
if kr=2 then writeln('4. legs blok');
cursor:=readkey;
case cursor of
#72:i:=i-1;
#80:i:=i+1;
end;
if i>4 then i:=i-4;
if i<1 then i:=i+4;
until cursor=#13;
if kr=1 then hit1:=i;
if kr=2 then blok1:=i;
kr:=kr+1;
until kr>2;
hit2:=random(4)+1;
blok2:=random(4)+1;
if hit1=1 then h1:='head'
else if hit1=2 then h1:='upper body'
else if hit1=3 then h1:='lower body'
else h1:='legs';
if hit2=1 then h2:='head'
else if hit2=2 then h2:='upper body'
else if hit2=3 then h2:='lower body'
else h2:='legs';
if blok1=1 then b1:='head'
else if blok1=2 then b1:='upper body'
else if blok1=3 then b1:='lower body'
else b1:='legs';
if blok2=1 then b2:='head'
else if blok2=2 then b2:='upper body'
else if blok2=3 then b2:='lower body'
else b2:='legs';
textcolor(blue);
if hit1<>blok2 then begin xp2:=xp2-1; writeln('Vi ydarili v ',h1); end;
if hit2<>blok1 then begin xp1:=xp1-1; writeln ('enemy ydaril v ',h2); end;
if hit1=blok2 then writeln('enemy zablokiroval ',b2);
if hit2=blok1 then writeln('Vi zablokirovali ',b1);
readkey;
until (xp1<=0) or (xp2<=0);
textcolor(cyan);
if (xp1<=0) and (xp2>0) then writeln('YOU LOSE')
else if (xp2<=0) and (xp1>0) then writeln('YOU WIN')
else writeln('NO WINNER');
readkey;
end.

Автор: Archon 28.05.2007 2:58

Я вот думаю, какой смысл играть в игры, где результат все равно определяется по рэндому?..

Автор: Tan 28.05.2007 13:17

В случае когда один играешь, то да, не особо весело, а когда с кем - то, то элемент соревновательности заключается в том, кому удача улыбнётся большее количетво раз.