IPB
ЛогинПароль:

> первая игра
brunis
сообщение 11.07.2012 11:33
Сообщение #1





Группа: Пользователи
Сообщений: 1
Пол: Мужской
Реальное имя: Denis

Репутация: -  0  +


Пожалуйста оцените игру и добавте идей smile.gif smile.gif
Игра написана на freepascal

Program Zombie;
Uses Crt;
Const Up = Chr(72); Down = Chr(80); Left = Chr(75); Right = Chr(77);
      Escape = Chr(27); Stop = ' ';

 Var key:Char;
    x,y,dx,dy,x1,y1:integer;
    zx,zy,q:integer;

    bx,by,c,counter,perm:Byte;
    boost,time:integer;
    speed,zspeed,sx,sy,bperm,a,GO:Byte;

Procedure PrintArena;
var i,j,y:Byte;
Begin
  textcolor(darkgray);
  y:=1;
  GotoXY(1,y);
  For i:=1 to 80 do write(chr(219));
  For i:=1 to 19 do Begin
    inc(y);
    Gotoxy(1,y);
    write(chr(219));
    For j:=1 to 78 do write(' ');
    write(chr(219));
  End;
  inc(y);
  Gotoxy(1,y);
  For i:=1 to 80 do write(chr(219));
End;



Procedure PrintXY(x,y:integer; s:string);
Var x0,y0:integer;
Begin
  x0:= WhereX;
  y0:= WhereY;
  GotoXY(x,y);
  Write(s);
  GotoXY(x0,y0);
End;


Function Interior(x,y:Integer): Integer;
Begin
  If (x>=WindMinX+1) then x1:=x1-1;
  if(x<=WindMaxX-1) then x1:=x1+1;
  if (y>=WindminY+1) then y1:=y1-1;
  if(y<=WindmaxY-5) then y1:=y1+1;
  Interior:=1;

End;

Begin
  ClrScr;
  CursorOff;
  PrintArena;
  q:=0;

  PrintXY(40, WindMaxY-2, ' Остановка - (пробел) . Конец - ESC .');
  PrintXY(25, WindMaxY-2, ' LEVEL 1');
  x:=(WindMinX + WindMaxX) div 2;
  y:=(WindMinY + WindMaxY - 2) div 2;
  dx:=0;
  dy:=0;
  PrintXY(x,y, '*');
  zx:=77;
  zy:=20;
  PrintXY(zx,zy,'$');
  c:=1;
  counter:=0;
  textcolor(lightgreen);
  PrintXY(2, WindMaxY-1, 'Zombie Dollar Ver.1.1.2');
  Randomize;
  boost:=0;
  speed:=40;
  zspeed:=2;
  time:=0;
  bperm:=1;
  go:=0;
  Repeat

    If c=1 Then Begin
      c:=0;
      perm:=1;
      bx:=Random(78)+2;
      by:=Random(19)+2;
      Gotoxy(bx,by);
      textcolor(red);
      Write(chr(3));
    End;


    If (boost=50) and (bperm=1) Then Begin
      bperm:=0;
      sx:= Random(78)+2;
      sy:= Random(19)+2;
      textcolor(LightBlue);
      PrintXY(sx, sy, chr(24));
    End;



    If KeyPressed Then Begin
      Case Readkey of
        #0: Begin
          key:= Readkey;
          Case key of
            Up:     Begin dx:= 0; dy:=-1; End;
            Down:   Begin dx:= 0; dy:= 1; End;
            Left:   Begin dx:=-1; dy:= 0; End;
            Right:  Begin dx:= 1; dy:= 0; End;
          End;
        End;
        Stop: Begin
          dx:=0;
          dy:=0;
        End;
        Escape: Begin Break; End;
      End;
    End;

    If ((bperm=0) and (time=150)) or ((a=1) and (time=540)) Then Begin
      If (a=1) and(time =540) then Begin
        time:=0;
        a:=0;
        PrintXY(2, WindMaxY-2,'      ');
        speed:=40;
        zspeed:=2;
      End
      Else Begin
        time:=0;
        gotoxy(sx,sy);
        Write(' ');
        bperm:=1;
        sx:=0;
        sy:=0;
      End;
    End;
    x1:= x+dx;
    y1:= y+dy;
    If (Interior (x1,y1) = 1) Then Begin
      if (bperm=0)or(a=1) then inc(time);
      boost:=Random(1000);
      textColor(lightgray);
      PrintXY(x,y, ' ');
      x:=x1;
      y:=y1;
      PrintXY(x,y,'*');
      If (x=sx) and (y=sy) Then Begin
        bperm:=1;
        speed:=20;
        zspeed:=5;
        textcolor(lightblue);
        PrintXY(2, WindMaxY-2,'BOOST!');
        a:=1;
      End;
      If (x=bx) and (y=by) Then Begin
        c:=1;
        if (perm=0) and (counter<2) then counter:=0
        else if (perm=0) then counter:=counter-2
        Else inc(counter);
      End;
      GotoXY(65,WindMaxY-1);
      write('(', x:3,' ;', y:3, ')');
      GotoXY(25,WindMaxY-1);
      write(counter:3,'/100');
    End;
    inc(q);
    delay(speed);
    If(q mod zspeed =1) then Begin
      if q =1000 then q:=0;
      textcolor(lightgreen);
      If (zx=bx) and (zy=by) Then Begin PrintXY(zx,zy, chr(15)); perm:=0; End
      Else PrintXY(zx,zy, ' ');
        If (y1 < zy) Then Begin dec(zy); PrintXY(zx,zy,'$'); End
               Else
        If (x1 > zx) Then Begin inc(zx); PrintXY(zx,zy,'$'); End
               Else
        If (y1 > zy) Then Begin inc(zy); PrintXY(zx,zy,'$'); End
               Else
        If (x1 < zx) Then Begin dec(zx); PrintXY(zx,zy,'$'); End;
    End;

    If (x1=zx) and (y1=zy) then GO:=1;
  Until (counter=100) or (GO=1);
  ClrScr;
  CursorOn;
  if GO=1 then Begin
    gotoxy(37,11);
    textcolor(Red);
    WRITELN('GAME OVER');
  End
  Else Begin
    gotoxy(37,11);
    textcolor(Lightgreen);
    WRITELN('Congratulation!!! you WON');
  end;
  readkey;
End.
 
 Оффлайн  Профиль  PM 
 К началу страницы 
+ Ответить 

Сообщений в этой теме


 Ответить  Открыть новую тему 
1 чел. читают эту тему (гостей: 1, скрытых пользователей: 0)
Пользователей: 0

 

- Текстовая версия 17.07.2025 7:53
Хостинг предоставлен компанией "Веб Сервис Центр" при поддержке компании "ДокЛаб"