# distance between pathfinding nodes

0 Favourites
• 5 posts
• I can't make this work! D:

How can I input this into construct2??

I want to measure the distance between all the nods on a path plus the distance between the player and node 0.

I just wanna know how long is the path =(

CAPX

distance(object,node0)+distance(node0,node1)+distance(node1,node2)... and so on.

• ## Try Construct 3

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

Construct 3 users don't see these ads
• The path between the nodes? When I run the .capx, I see multiple possible paths, which would create problems as the path taken would determine how long the path actually is.

One thing you can try is to create an invisible sprite that pathfinds from node to node and track its travel distance in some sort of variable.

• Well... I kind of need the game to calculate each path on real time... Can't see how's a problem to use the path-finding behavior as intended -_-

And as of the objects as pin-points. would leave me in the exact same spot, since what i'm having problem with is how to input the logic.

I know construct can calculate the distance between two points. And I know I can repeat this calculations times the number of nodes. However, i don't know how to tell the program to do it the way i want it to do it =(

• The problem is in the order of the events.

If you add the distance from sprite(x,y) right after setting the distance to 0 on left-mouse-click you get the expected results.

• haha, yeah, I had noticed that xD

and I think I got it right now.

fixed

<img src="https://dl.dropboxusercontent.com/u/20613220/Captura.PNG" border="0">

what i need was to only count the segments between nodes, plus the segment between object and node 0

however i don't have the slightest idea why the "pick lowest" condition is picking both instances... the manual said that even if 2 instances had the same value, would pick only one anyway...