Wizard
14-12-2006, 06:20 AM
Hi there.
I'm busy with a game using delphiX and would like to change the image to an explosion when my bullet/bomb hits my enemies...I had a look at the DelphiX Shoot sample and tried the code but it has no effect.
Here's my Bullet.DoCollision:
procedure TBullet.DoCollision(Sprite: TSprite; var Done: Boolean);
begin
If (Sprite is TEnimy) then
begin
Sprite.Collisioned := False;
Sprite.Dead;
Enimies := Enimies -1;
Form1.DXWaveList1.Items.Find('hit').Play(False);
dead;
// Image change
Image := Form1.DXImageList1.Items.Find('Explode');
Width := Image.Width;
Height := Image.Height;
Dead;
Points := Points + 1000;
Done := False;
end;
if (Sprite is TDisk) then
begin
Sprite.Collisioned := False;
Sprite.Dead;
Form1.Disk_No := Form1.Disk_No -1;
Form1.DXWaveList1.Items.Find('hit').Play(False);
// Image change
Image := Form1.DXImageList1.Items.Find('Explode');
Width := Image.Width;
Height := Image.Height;
dead;
Points := Points + 2000;
SpaceMines := SpaceMines + 1;
if collisioned = true then
Form1.NewDisk;
Done := False;
end;
end;
Any help/suggestions?
I'm busy with a game using delphiX and would like to change the image to an explosion when my bullet/bomb hits my enemies...I had a look at the DelphiX Shoot sample and tried the code but it has no effect.
Here's my Bullet.DoCollision:
procedure TBullet.DoCollision(Sprite: TSprite; var Done: Boolean);
begin
If (Sprite is TEnimy) then
begin
Sprite.Collisioned := False;
Sprite.Dead;
Enimies := Enimies -1;
Form1.DXWaveList1.Items.Find('hit').Play(False);
dead;
// Image change
Image := Form1.DXImageList1.Items.Find('Explode');
Width := Image.Width;
Height := Image.Height;
Dead;
Points := Points + 1000;
Done := False;
end;
if (Sprite is TDisk) then
begin
Sprite.Collisioned := False;
Sprite.Dead;
Form1.Disk_No := Form1.Disk_No -1;
Form1.DXWaveList1.Items.Find('hit').Play(False);
// Image change
Image := Form1.DXImageList1.Items.Find('Explode');
Width := Image.Width;
Height := Image.Height;
dead;
Points := Points + 2000;
SpaceMines := SpaceMines + 1;
if collisioned = true then
Form1.NewDisk;
Done := False;
end;
end;
Any help/suggestions?