0 Favourites

Tilemap pathfinding/collision question

  • Im currently working on the movement part of my tactical combat system and it works somewhat, however there are something that give me some problems, which is the path finding, im well aware of the limitation of this behavior, so I only use it to find the path, all movement are done manually. However when it find a path it seems to have some problems correctly updating the collision map.

    All tiles with red and white lines are part of the tilemap which have a solid behavior. So they are seen as collision tiles. So all enemies have the tile where they are standing on made as a collision tile. When they start moving I erase that tile and then calculate path to a player character. And when they are done moving I update the tilemap again and regenerate the obstacle map for the enemies.

    So an example where it works.

    In this case the enemy will correct move around the enemy standing on tile (4,12) when it tries to reach tile (3,12).

    For some reason this doesn't always work as in this example.

    Where the enemy is suppose to go to tile (27,25) and the tile at (26,24) is not a collision tile.

    However it choose to move on top of the enemy at tile (26,25). And I just cant figure out why it works in some cases and not in others.

    The manually movement will go from one path finding node to another, so if the path finding have plotted a wrong path then the manual movement will fail. But what I don't get is why doesn't It register this tile as being a collision tile, but in other cases it have no problem. The movement of the enemies are triggered when a path is found as recommended in the manual. If anyone have tried something similar or know what the problem can be I would appreciate any help.

    Here are some quick facts.

    1. Only 1 enemy moves at the time.

    2. Before an enemy starts moving the obstacle map is updated.

    3. After an enemy have moved the tilemap is updated.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)