How do I use Tilemap with pathfinding

0 favourites
  • 2 posts
From the Asset Store
Units do not overlap each other and use different ways if there are several free ways.
  • Hi guys,

    i am generating a tilemap with solid behavior at runtime. after that i put a player and enemy at random positions. the enemy got the pathfinding behavior and starts to move towards the player right after the game started. but its path is always a straight line ignoring all obstacles. therefore i added an "regenerate obstacle map" right after the tilemap was generated. unfortunatelly it changed nothing, the enemy is still ignoring the obstacles.

    BUT if i put a System.wait right after the "regenerate obstacle map" it worked fine. So that means regenerating the map takes a while and not just 1 tick as statet in the manual.

    So my question is: Is there an event like "On obstacle map finished"? I was not able to find it. Or maybe i am using a wrong approach, how did you handle that problem in your projects?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Sounds like you need to have it find a path after it has regenerated its obstacle map, otherwise it will find a path before there are any obstacles (a straight line). I don't recall there being a "On obstacles regenerated" event, but you should be able to pull it off by arranging the events chronologically to make sure they happen in the right order.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)