Select multiple objects from families

0 favourites
  • 4 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Hey there,

    maybe my brain's just too tired, but I can't find how to make this work properly (see capx).

    Basically, I'm trying to select one or several units, then have them pathfind their way to the touch/pointer. Very classic.

    Thing is :

    * I do not use a selection box : every unit is selected when passing the finger/pointer over it. That part works just fine and I like it.

    * And, my units are in a family called "UNITS", which has a family pathfinding behaviour, but they are also in a family called "SELECTABLE" (among with buildings, etc.), which has the "is selected" boolean variable. Meaning I don't select units directly : I select selectable objects, and if those happen to also be units, then they will move on click as units should.

    The issues I'm facing are :

    1. The selection rectangle that marks when an object is selected doesn't always follow the object when it moves (it seems to stick to the object only if it was the first one that was selected or something)

    2. No unit will move unless the unit with the lowest UID is selected. And then, they will move even if they are not selected themselves.

    I feel like it all has something to do with instance picking between families, but I'm really at a loss about what to do to solve it. Unless maybe I remove the bigger "SELECTABLE" family and have the game select every family of objects separately, but that would suck.

    Thanks in advance if anyone can help.

  • Hey Kan,

    Here you go! I think I made it work the way you wanted. Let me know if you have questions on what I changed.

  • thatserafimkid : Seems to work fine now! Thanks a lot!

    I sometimes get lost when it comes to finding in what order to put instance-picking conditions and which ones to use.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You're welcome. Glad I could help.

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