Tilemap pathfinding/collision question

Get help using Construct 2

Post » Thu May 15, 2014 3:06 pm

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.

Image

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.
Image
In this case the enemy will correct move around the enemy standing on tile (4,12) when it tries to reach tile (3,12).

Image

For some reason this doesn't always work as in this example.
Image
Where the enemy is suppose to go to tile (27,25) and the tile at (26,24) is not a collision tile.

Image
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.
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,828

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 2 guests