How do I ... Automated Pathfinding

0 favourites
  • 3 posts
From the Asset Store
Units do not overlap each other and use different ways if there are several free ways.
  • Hi! It's me again!

    This time I've been toying around with possibility of doing a RTS and I got some of the base mechanics down when it comes to movement and harvesting which are working with some weird exceptions and I wondered if anyone can help me figure this out

    My code is as following:

    and this is the exact same except switching out the food parts to gold, stone and wood

    and it works and don't work as the image below shows:

    The weird part is it's not a error in the code as you might think, the problem lies in the positioning of the blocks it seems because if I put the gold and stone (the two on the right) where the wood and food (the two on the left) are they work but the wood and food don't.

    Can anyone help me figure this out? I've tried placing the blocks further away from the "base", to no affect so it's not that they are too close.

    If you need to have a look at my capx to get a closer look let me know and I'll PM you with a link for it.

    Edit: Forgot to mention during the debugging on the ones that don't work the game finds a path to the destination but it don't start moving along the path.

    Edit 2: I've noticed this only happens to resources that are to the right of the main base, if that helps anyone understand what the problem could be.

    Maybe pathfinding cant go into -x or something? It just confuses me more than I am now personally...

    Edit 3: I tried moving the base to the right of all the resource nodes and then it works just fine and then if I move it to the left of the nodes none of them work, so it seems like if the position I wanna go to from the node is in - X from the original position it don't work.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Have another look at the manual. You can't call 'Move along path' until you get 'On path found'.

  • It works though, it works on every place except the ones who are too far right of the "base" but I guess I'll just add a "on path found" and it should work?

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