Hello User137!
My main problem the appearance of enemy's bullets, which happening at wrong place. Its may has to do with moving and deleting of the bullets?
I do it as follows:
Code:
if numofbullets>0 then
begin
i:=0;
while i<numofbullets-1 do
begin
if bulletarray[i]<>nil then
begin
if (bulletarray[i].xplace>ClientWidth) or (bulletarray[i].xplace<1) or (bulletarray[i].yplace>ClientHeight) or (bulletarray[i].yplace<1) or (collwithplayer(bulletarray[i].xplace,bulletarray[i].yplace)=1) then
begin
freeandnil(bulletarray[i]);
if i=numofbullets-1 then
dec(numofbullets)
else
begin
for j:=i+1 to numofbullets-1 do
bulletarray[j-1]:=bulletarray[j];
dec(numofbullets);
dec(i);
end;
end else
begin
bulletarray[i].yplace:=bulletarray[i].yplace+4
MainWindow.Canvas.Draw(bulletarray[i].xplace,bulletarray[i].yplace,bulletarray[i].itsimage);
end;
end;
inc(i);
end;
end;
Maybe it is wrong?
Bookmarks