Pathfinding goes right through solids as if it wasn't there

0 favourites
  • 9 posts
From the Asset Store
Units do not overlap each other and use different ways if there are several free ways.
  • [attachment=0:s0alvgtf][/attachment:s0alvgtf]Hi, so I'm making a TD game and I want the enemy sprite to move through a maze generated by the user.

    Problem is, is that the pathfinder doesn't work at all. Not only doesn't it find a path, the sprite also goes right through all solids.

    Yes, the enemy and the solid "walls" made of turrets are both solids.

    The path finder just totally ignores the solid.

  • Here's the properties

  • And the other since it won't let me upload more than 1 pic at a time

  • actually to be more specific,

    The enemy ONLY goes through Spawned versions of the turret, but the origional turret behaves correctly (it treats it like a solid and avoids it).

    Why is it that it is only going through the spawned turrets? I thought the spawned turrets inheret the properties of the origional.

  • I'm guessing you haven't recalculated the path finding map (regenerate obstacle map) after a new turret has been spawned/placed.

  • Hi thanks so much for responding,

    Yes after testing each possible variable, after like 5 hours I figured out that the enemies were moving to the conditions set at the start of the map regardless of what solids were moved/spawned around afterwards

    I was looking for could reset this "initial condition" but I couldn't find it.

    Thanks for telling me.

    My next problem is that I don't have "Regenerate obstacle map" as an action.

    What I do is:

    I click on action -> look at Layers&Layouts-> *But I don't see regenerate obstable map anywhere.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The "regenerate obstacle map" action is under the object that has the "pathfinding behaviour". So if your object that has "pathfinding behaviour" is "enemy" double click it and scroll down until you find the "pathfinding" sub-heading.

    [attachment=0:3lcpcrdj][/attachment:3lcpcrdj]

    You'll probably need to put this action in the event for adding a new turret to the map.

  • Got it thanks so much!

    Now I'm going to try to add multiplayer features with a Lobby and everything for an online 1 vs 1 turret defense game.

    But....I'm looking at rexrainbow's smaple code andd wow it looks diffiicult!

  • Even better, if you're regenerating the map every time an object is created there is an action to only regenerate the region around that object. You'll avoid a lot of unnecessary happenings this way.

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