So, your error is in the loop in DXDrawInitialize procedure. Your loop goes from 0 to mtiles, but in this way you are trying to access 4 tiles. In fact, you get an access violation error starting the game.

[pascal]procedure TForm22.DXDraw1Initialize(Sender: TObject);
var imgcnt:integer;
begin
Form22.DXTimer1.Enabled:=true;

//for imgcnt := 0 to mtiles do
for imgcnt := 0 to mtiles - 1 do // <<<<< Here!!
begin
tiles[imgcnt] := tdirectdrawsurface.create(form22.dxdraw1.DDraw);
tiles[imgcnt].loadfromgraphic(form22.DXImageList2.Items[imgcnt].Picture.Graphic);
end;
GameState:=gsStart;
end;
[/pascal]