How do you return the orange node closest to the character on the search path?

0 favourites
  • 8 posts
From the Asset Store
Node Downloader is a plugin for download file for Construct 3 and construct 2 game engine
  • Hello,

    do you know how I can do return the orange node closest to the character on the search path?

    orange dots = knots

    the small purple squares = the path (patchfinding)

    I'd like to move the character not with the pathfinding behavior but with “move to” to make it look cleaner, any ideas?

  • On the orange dot object there is a condition 'pick nearest' you can use this and pick nearest to player position.

  • Yes, but it's not just the one closest to the player, but the one closest to the player on the way!

    Thank you.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The one closest to the player on the way ?

  • Ah ah, I would like to return the orange node closest to the player follow the path search, not very clear?

    It's complicated what I want to do, really not easy at all!

    When I double-click on a node, the program must:

    Search for the orange node closest to the player, but in the direction of the destination, in the example with the image, it's node: B8, get it?

    Only it has to be the next orange node on the path towards the target, understand?

    I've done this, but it only works on one condition: as indicated, this is what it does, but not what I want. If you're less than half the distance to the next orange node, then the node you return to will be the one before, not the next, so it's no good, imagine you're less than half the distance to node B8 (between B7 and B8, but before B8), so if I double-click on B8 or B1 or even B2 or D2, C3, D1, for example, it will return B7 when it should be B8 because it's the next node in the direction of X.

    Test this and you'll see, depending on where you are, there may be errors.

    try between B8 and B1 when the character moves from one to the other, and you'll see some problems.

    drive.google.com/file/d/1zlWIeCnHETZ_M4H9ydx1EC7F3ya07XWf/view

    Anyway, there are still things I want to do here but I'll post when I want.

  • You'll need a way to identify every node. For each node, you'll then need a list of other nodes connected to it.

    First pick by connected nodes (compare instance variable), then pick by distance.

  • You could try using combination of pick nearest and compare Y, so if I am standing very close to B7 and select D1, if I say pick nearest and (because D1 Y is less than player.Y) pick node where Y is less than player.Y it will go to B8 and not B7.

    edit : ooo yes the above makes sense, I don't know how you were doing paths already but listing all nodes in an array and go to each one sounds interesting.

  • I’m not sure it works, it’s not easy. Moreover, I would like that when the character moves along the path, the closest node is highlighted. In this way, each node will successively be large and small depending on the player’s position. In reality, I would like to move it node by node to the destination, but I don’t know how to do that. I know that “move towards” is an option to make “passages”, but this one doesn’t really suit me because I want the character to slow down when it arrives at a node and then gradually accelerate to the maximum speed to go to the other. The interpolation behavior is perfect for this and that’s what I want to use, but I don’t know how to list all the nodes on the path. It’s all very complicated.

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