How do I do Custom Pathfinder for Hex Maps

0 favourites
From the Asset Store
A template which allows you to customise the controls of your game.
  • tarek2

    This would be a case where it would be nice if C2 allowed you to step though the code with the debugger. Anyways it may be helpful to read about the A* elsewhere to see how it works.

    I use the 'done' variable to stop the looping. It's only set when the goal tile is reached. The reason it keeps looping even though it starts with only one object that's 'open' is the neighboring tiles are picked with a family and added to 'open'. To clarify node and othernode can refer to the same objects. Maybe that's where the confusion is.

    The return value is not used in this particular example isn't used but in cases where a path can't be found 0 is returned. That can happen when trying to find a path to a separate island of nodes.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • tarek2

    This would be a case where it would be nice if C2 allowed you to step though the code with the debugger. Anyways it may be helpful to read about the A* elsewhere to see how it works.

    I use the 'done' variable to stop the looping. It's only set when the goal tile is reached. The reason it keeps looping even though it starts with only one object that's 'open' is the neighboring tiles are picked with a family and added to 'open'. To clarify node and othernode can refer to the same objects. Maybe that's where the confusion is.

    The return value is not used in this particular example isn't used but in cases where a path can't be found 0 is returned. That can happen when trying to find a path to a separate island of nodes.

    I see that makes more sense now, is gonna take me time to fully understand it through my brain is been spinning like crazy that is an awesome Loop man I need to learn that, I didn't know you can do that with a Function in one call

    [quote:1pvwkbwj]This would be a case where it would be nice if C2 allowed you to step though the code with the debugger.

    That would be awesome would have saved me one week of debugging running in circles I tried all kind of tricks and no luck jeje

    I will keep reading about A* like you said to learn more about it.

    Thank so much R0J0hound for all your help

    Take care

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