PDA

View Full Version : 2D collision map



dagrlo
21-10-2003, 11:11 AM
I'm trying to make a 2D game with DelphiX.

i defined the map but i want to use the collisionmap
to detect collisions with the background.

I don't know how to initialize it because it doesn't work.

i tried making a tbackgroundsprite, a normal sprite and all the posibilities
but it is ****ing me!!!

:shock:

Traveler
21-10-2003, 12:38 PM
I'm not sure what you want to do with your map, but have a look at the third tutorial on my website. In there I show you how to build a map including collision information.

dagrlo
22-10-2003, 04:00 PM
the code that i've used is:

mybackground:=tbackground.create(dxspriteengine.en gine);
with mybackground do
begin
image:=dximagelist.items.find('backimgs');
image.transparent:=false;
setmapsize(mapwidth,mapheight);
z:=-2;
for i:=0 to mapwidth-1 do
for j:=0 to mapheight-1 do
begin
chips[j,i]:=maparray[j,i];
collisionmap[j,i]:=collisionarray[j,i];
end;
tile:=true;
end;

the maparray is --> maparray:array[1..mapwidth,1..mapheight] of byte;

the bytes are the number of the texture block in my imagelist.

the collisionarray is --> collisionarray[1..mapwidth,1..mapheight] of boolean;

the booleans are true if i can pass the block.

i can't wrote this the other day because i wasn't in my house.

i found this functions in a tutorial that i looked in turbo.com. but
it don't works. is my code useless?

i can't read your tutorial today but i want to look it.

if you need more info post a reply :shock: