ВНИМАНИЕ! в архиве находятся уже скомпилированные программы. Рекомендую проверить содержимое антивирусом... админ.
Сообщение отредактировано: SHnur -
--------------------
Двадцать пятый час в сутках может появиться всего лишь из-за небольшой ошибки в программе. Чтобы не воспользоваться сумасшедшими возможностями, нужно быть идиотом.
procedure dxy(key : char); var res : point; f :boolean; begin f := false; case key of left : begin if delta.x <> a then begin res.x := -a; res.y := 0; f := true; end else res := delta; end; up : begin if delta.y <> a then begin res.x := 0; res.y := -a; f := true; end else res := delta; end; right : begin if delta.x <> -a then begin res.x := a; res.y := 0; f := true; end else res := delta; end; down : begin if delta.y <> - a then begin res.x := 0; res.y := a; f := true; end else res := delta; end; end;
if not(f) then res := delta;
Delta := res; end;
procedure ShrArray; var i :integer; begin for i := n downto 2 do begin snake[i].x := snake[i-1].x; snake[i].y := snake[i-1].y; end; end; {--} function inarr:boolean; var res : boolean; i :integer; begin res := false; for i := 1 to n do begin if (lastfood.x = snake[i].x) and (lastfood.y = snake[i].y) then res := true; end; inarr := res; end; {--} procedure food; begin repeat lastfood.x := random((weidht div a)-15)*a + bleftx+a; lastfood.y := random((height div a)-15)*a + bupy+a; until not(inarr);
setallcolor(pcol); bar(lastfood.x+1,lastfood.y+1,lastfood.x+a-2,lastfood.y+a-2); end; {--} function MainSnake:boolean; {True - ziv , false - mertv} var i , dx , dy : integer; res : boolean; begin res := true; dx := delta.x; dy := delta.y;
setallcolor(Maincol); bar(snake[1].x,snake[1].y,snake[1].x+a-1,snake[1].y+a-1); end else begin res := false; end; end else begin res := false; end; if (snake[1].x = lastfood.x) and (snake[1].y = lastfood.y) then begin score := score + speed*10; inc(n); sound(800); delay(2); sound(400); delay(2); nosound; food; end;
MainSnake := res; end; {--} procedure dxy(key : char); var res : point; f :boolean; begin f := false; case key of left : begin if delta.x <> a then begin res.x := -a; res.y := 0; f := true; end else res := delta; end; up : begin if delta.y <> a then begin res.x := 0; res.y := -a; f := true; end else res := delta; end; right : begin if delta.x <> -a then begin res.x := a; res.y := 0; f := true; end else res := delta; end; down : begin if delta.y <> - a then begin res.x := 0; res.y := a; f := true; end else res := delta; end; end;
if not(f) then res := delta;
Delta := res; end;
repeat if keypressed then begin key := readkey; if (key = #0) then key := readkey; end; if key <> pause then begin dXY(key);
ts := score;
nekonec := MainSnake;
if ts <> score then dumpscore;
delay((11-speed)*10{00}); end;
until (key = esc) or not(nekonec);
Это не весь код , но тут всё ясно !
winter выложу вечером . Выкладывай полный код!!!!!! админ.
Сообщение отредактировано: Oleg_Z -
--------------------
Двадцать пятый час в сутках может появиться всего лишь из-за небольшой ошибки в программе. Чтобы не воспользоваться сумасшедшими возможностями, нужно быть идиотом.