Results 1 to 3 of 3

Thread: 2D collision map

  1. #1

    2D collision map

    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:

  2. #2

    2D collision map

    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.

  3. #3

    2D collision map

    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:

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •