Hi guys

I'm quite new to Delphix and am trying to write my first game - a Bomberman clone. I have successfully completed the "Pacman" collision detection tutorial and the collision detection worked. However, I can't get this to work in my own code. I have compared the equivalent parts of my code with the code from the tutorial and it all looks ok. I'd be really grateful if anybody could look over my code and help me find out what's wrong.

Thanks
Mark


[pascal]TWhite = class(TImageSprite)
public
procedure DoMove(MoveCount: Integer); override;
procedure DoCollision(Sprite: TSprite; var Done: Boolean); override;
end;

TBrick = class(TImageSprite)
public
end;

var
White: TWhite;
bricks: array[1..150] of TBrick;
map: TStrings;

implementation

{$R *.dfm}

procedure setupmap();
var
i: integer;
begin
map:=TStringList.Create;
for i:=1 to 15 do map.Add('eeeeeeeeeeeeeee');
end;

procedure placebricks();
var
i,x,y,l: integer;
t: string;
begin
randomize();
for i:=1 to 150 do begin
l:=0;
while l=0 do begin
x:=random(15);
y:=random(15);

if map[y][x+1]='e' then begin
if x+y>1 then begin
t:=map[y];
t[x+1]:='b';
map[y]:=t;
l:=1;
end;
end;
end;

Bricks[i] := TBrick.Create(form1.DXSpriteEngine1.Engine);
Bricks[i].Image := Form1.DXImageList1.Items.Find('Brick');
Bricks[i].X := 25+x*50;
Bricks[i].Y := y*50;
Bricks[i].Height := 51;
Bricks[i].AnimCount := 1;
Bricks[i].AnimStart := 0;
Bricks[i].AnimLooped := True;
Bricks[i].AnimSpeed := 50/1000;
end;
end;

<MAP SETUP CODE REMOVED>

procedure TForm1.DXTimer1Timer(Sender: TObject; LagCount: Integer);
begin

<INPUT CAPTURE AND SPRITE MOVEMENT CODE REMOVED>

DXImageList1.Items.Find('Background').
Draw(DXDraw1.Surface,0,0,0);

DXSpriteEngine1.Move(2);
DXSpriteEngine1.Draw;
DXDraw1.Flip;

end;

procedure TWhite.DoMove(MoveCount: Integer);
begin
inherited;
PixelCheck := True;
Collision;
end;

procedure TWhite.DoCollision(Sprite: TSprite; var Done: Boolean);
begin
showMessage('bang');
end;

end.[/pascal]