Collision Area for Tiles

  • Hey, this is my first time posting here. New to HaxeFlixel but have a lot of experience with Haxe/OpenFL and AS3. I started with the TurnBasedRPG demo, then modified it to load a map from CastleDB instead. So I wrote the code to go through the tile properties and set the collision areas, but I can't find a way to customize the actual hit area of the tiles. The castle maps let you set collide on the tiles to left, right, etc. but of course if I try to map that to UP, DOWN, etc. it doesn't work like I'd expect:

    else if (tileProps.collide == "Bottom") collide = FlxObject.DOWN;
    // ...
    tileMap.setTileProperties(i+1, collide);

    Of course the reason is because I was naive and confused castle's meaning, which is you can't pass the bottom part of the tile, with what flixel means, which is you can't enter from below (but can from the other direction). Is there an easy way to get what I want with the existing classes? If not, what's the shortest path to implementing this? I hope I don't have to lay down a sprite everywhere there's a cliff edge...

  • I ended up making another map of 4^2 as many tiles 1/4th as large, each tile being invisible/transparent but some being hits. This gives me more flexibility but still the ability to use Flixel's hit detection.

  • This may be late but you can try altering FlxObject.SEPARATE_BIAS
    Perhaps like:

    FlxObject.SEPARATE_BIAS = tileSize;

Log in to reply

Looks like your connection to HaxeFlixel was lost, please wait while we try to reconnect.