Сообщение от Mark Castle

procedure bombarding;
begin
q:=15;
u:=0;
if (q>x) and (q<(x+19)) and (u<43) and (u>38 ) then sledujushcajaprocedura;
end;
Пожалуста разъясните почему оно не пашет,и как сделать,чтоб все работало!
|
Ты пытаешься вызвать процедуру из самой себя (вроде рекурсией называется)
Вынеси жирную строку из процедуры в игровой цикл.
Выглядеть будет примерно так:

Program Bombardeer;
const
fieldwidth = 70;
fieldheight = 70;
var
gameField: array[1..fieldWidth, 1..fieldHeight] of integer;
screenWidth, screenHeight : integer;
screenX, screenY : integer;
X,Y,key :integer;
Q,U,z,O,P,i,H,J,F,G :integer;
pig,fon,bomber,stn,bomb :image;
play,exit :command;
//...........
procedure bombarding;
begin
q:=15;
u:=0;
end;
//.........
begin
stn:=LoadImage('/stn.png');
bomb:=LoadImage('/bomb.png');
bomber:=LoadImage('/bomber.png');
fon:=Loadimage('/fone.png');
pig:=LoadImage('/pig.png');
X:=25; Y:=45;
F:=0; G:=0; H:=90; J:=4;
O:=0; P:=15; Q:=25; U:=5;
repeat //Начало игрового цикла
DrawImage(fon,F,G);
DrawImage(stn,O,P);
DrawImage(bomber,H,J);
DrawImage(pig,X,Y);
DrawImage(bomb,Q,U);
SetColor(140,0,140);
fillrect(0,50,150,90);
if x<0 then x:=0;
if y<0 then y:=0;
if x>84 then x:=84;
key:=keyToAction(GetKeyPressed);
if (key=GA_RIGHT) then X:=X+3;
if (key=GA_LEFT) then X:=X-3;
if (key=GA_UP) then Y:=Y-0;
if (key=GA_DOWN) then Y:=Y+0;
i:=i+1;
if (i>0) and (i<45) then H:=H-2;
if (i>44) and (i<92) then H:=H+2;
if i=92 then begin i:=0; H:=90; end;
if (q>x) and (q<(x+19)) and (u<43) and (u>38 ) then bombarding;
repaint;
delay(100);//Лучше использвать именно здесь(т.е. после repaint;)
until (key=KE_KEY0);// выходим из цикла по нажатию "0"
end.

Только я не понял, что именно должна делать процедура bombarding.
И вообще если хочешь, чтоб тебе помогли, то
1) либо пиши код программы с пояснениями по каждой строке
2) либо выкладывай исходнег(заархив-ую папку с проектом)