How do I reference per UID in familiy?

0 favourites
  • 8 posts
From the Asset Store
Act on your instances, get/set their properties and variables only thanks to their UID. No more picking trouble! Plugin
  • 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.

    [attachment=0:1nlypbqa][/attachment:1nlypbqa]

    How do I solve this more elegantly?

  • 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.

  • well, alright. hopefully not gonna be more than a handful, bit unsatisfying though.

    thanks for your time

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

  • 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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?

  • Can you post that solution?

  • 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:

    [attachment=0:1ifbztvg][/attachment:1ifbztvg]

    thx again, ramones

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