How do I reference per UID in familiy?

Get help using Construct 2

Post » Mon Sep 08, 2014 9:10 pm

HI,
I have a character moving between waypoints of different types, all part of the family 'waypoints'.
Each waypoint can reference another one by UID (changes during runtime), so the character knows where to go to next.
Right now I need to 'cast' per type to react to the different types, which feels besides the point of families, especially as the action is the same for all cases.

waypointTypeDistinction.PNG


How do I solve this more elegantly?
You do not have the required permissions to view the files attached to this post.
B
12
S
5
Posts: 216
Reputation: 1,692

Post » Mon Sep 08, 2014 9:44 pm

That's pretty much it. This has been discussed a few times recently. How many waypoint types are in the family? If just a few then this looks fine.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Mon Sep 08, 2014 9:59 pm

well, alright. hopefully not gonna be more than a handful, bit unsatisfying though.
thanks for your time
B
12
S
5
Posts: 216
Reputation: 1,692

Post » Mon Sep 08, 2014 10:00 pm

Looks like you just need a "pick all Waypoints" and then pick the Waypoints family by UID.
B
55
S
29
G
19
Posts: 1,520
Reputation: 25,640

Post » Mon Sep 08, 2014 10:07 pm

You could have an instance variable that denotes the WP "type", and act according to that, but you would need all instance variables from all the different WP types on the family, and you'd still need a similar code structure.. so not much gained probably.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Tue Sep 09, 2014 7:33 pm

ramones wrote:Looks like you just need a "pick all Waypoints" and then pick the Waypoints family by UID.


Sweet! Exactly what I need, it works.

I don't really understand why I need to pick all waypoints first, if I had the UID in the first place already?
B
12
S
5
Posts: 216
Reputation: 1,692

Post » Tue Sep 09, 2014 9:48 pm

Can you post that solution?
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Wed Sep 10, 2014 8:19 pm

Sure.
So for context, different types of waypoints all hold a variable that is the UID of the next waypoint to go to after reaching this one.
And this is how I hand the stored (next) UID to the player when running into one:

waypointPickAll.PNG


thx again, ramones
You do not have the required permissions to view the files attached to this post.
B
12
S
5
Posts: 216
Reputation: 1,692


Return to How do I....?

Who is online

Users browsing this forum: rayolf and 34 guests