distance between pathfinding nodes

Get help using Construct 2

Post » Tue Jul 30, 2013 7:16 am

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.Sargas2013-07-30 07:19:18
B
43
S
12
G
6
Posts: 446
Reputation: 6,797

Post » Tue Jul 30, 2013 7:22 am

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.
Project Lead of Zems Online Card Game

Producer at Impulse Limited
B
18
S
6
G
3
Posts: 677
Reputation: 5,224

Post » Tue Jul 30, 2013 8:00 am

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 =(
B
43
S
12
G
6
Posts: 446
Reputation: 6,797

Post » Tue Jul 30, 2013 8:28 am

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.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Tue Jul 30, 2013 8:38 am

haha, yeah, I had noticed that xD

and I think I got it right now.

fixed



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...Sargas2013-07-30 08:43:11
B
43
S
12
G
6
Posts: 446
Reputation: 6,797


Return to How do I....?

Who is online

Users browsing this forum: Aergo, anty21ro, Ethan, Fenix18, Iftikhar555, oosyrag and 15 guests