Hi guys, I previously posted a topic under internal error Pro-2688 and got some feedback suggesting that I update Delphi 6. I did and the same error is still there. I'm coding a starfighter game with Delphi 6 and DelphiX.

This is what happens when my bomb hits my player: The app freezes and I have to use cntrl, alt & delete to termanate. After pressing run again in the IDE nothing happens and when I press Pause in the IDE the following error is shown: Project raised exception class EAccessViolation with message Access violation at adress 0000000 read of adress 0000000. When I press OK on this error another error appears, which is: Internal Error PRO - 2688 with delphi 32.exe - BORdbk60.dll on the toolbar of the error. Then I have to close the IDE with cntrl, alt & delete again.

My collision code is correct, I think, and sometimes the game works perfectly.


Is there an expert who can help me please?


Some of my code:

[pascal]
//This is the player class
TPlayer = class(TImageSprite)
private
Fired: Integer;
public
procedure DoMove(MoveCount: Integer); override;
end;

//This is the Bomb class
TBomb = class(TImageSprite)
public
procedure DoMove(MoveCount: Integer); override;
procedure DoCollision(Sprite: TSprite; var Done: Boolean);override;
end;

function TForm1.NewPlayer;
begin
Player_No := Player_No + 1;
with TPlayer.Create(DXSpriteEngine1.Engine) do
begin
Player.Image := Form1.DXImageList1.Items.Find('Player');
Player.X := 500;
Player.Y := 710;
Player.Width := Player.Image.Width;
Player.Height := Player.Image.Height;
Result := True;
Lives:= Lives -1;
end;
end;

procedure TForm1.GameEnd;
begin
If Player_No >2 then
with DXDraw1.Surface.Canvas do
begin
DXTimer1.Enabled := False;
Timer1.Enabled := False;
DXWaveList1.Items.Find('Tada').Play(False);
Font.Size := 26;
Font.Color := clYellow;
DXDraw1.Surface.Fill(0);
TextOut(290,220,'GAME OVER,YOU LOST ');
TextOut(290,270,'PRESS ESCAPE KEY AND TRY AGAIN');
end;
end;

procedure TPlayer.DoMove(MoveCount: Integer);
var
MyX: Double;
MyY : Double;
begin
If moveLeft and
(x>5) then
X := X - 10;

If moveright and
((X+Form1.DXImageList1.Items.Find('Player').Width) <Form1>5) then
Y := Y - 10;

if Movedown and
(y<form1.DXDraw1.Height-65)then
Y:= Y + 10;

MyX := X;
MyY := y;

//Check whether button1 is pressed (SPACEBAR)
If isButton1 in Form1.DXInput1.States Then
begin
if Fired <= 3 then
begin
Inc(Fired);
with TBullet.Create(Form1.DXSpriteEngine1.Engine) do
begin
Image := Form1.DXImageList1.Items.Find('Bullet');
Form1.DXWaveList1.Items.Find('Fire').Play(False);
X := MyX + 30; //Set it's X pos to our current X pos
Y := MyY; //Set it's Y pos to our current Y pos
Width := Image.Width; //Set it's size
Height := Image.Height;
end;
end;
end;
end;


procedure TBomb.DoMove(MoveCount: integer);
begin

Y := Y + 25;
Collision;
if (Y >= Form1.DXDraw1.Height +20) Then
Dead;
end;


procedure TBomb.DoCollision(Sprite: TSprite; var Done: Boolean);
begin
If (Sprite is TPlayer) Then
begin
Sprite.Collisioned := False;
Sprite.Dead; //Kill the Sprite
Form1.DXWaveList1.Items.Find('hit').Play(False);
Player.Dead;
Done := False;
end;
end;


Called in DXTimer:
if (player.Deaded) and (Player_No <= 2) then
NewPlayer;
GameEnd;
[/pascal]