How do I pick 2 objects in family

0 favourites
  • 12 posts
From the Asset Store
A collection of various zombie characters sprites for creating a 2D platformer or sidescroller game
  • Hi everyone,

    Im having a problem with a family.

    I have 2 objects in the family.

    A "lemon" and an "apple"

    however, i have copied them in the layout, so there is 2 lemons, and 2 apples in the game.

    How can i pick both lemons in the family, when i click a single lemon?

    i really need your help on this!

  • Anyone got an idea?

  • Upload the file an i fixed for you.

  • I don't know a lot about family's , but may try to make separate family's . 1 apple family and 1 lemon family, I'm sure there's a easier way but until you find it this may work.

  • If you want to pick only lemons, just use System> Pick All> Lemons, no need for a family here

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I have quite a number of objects in the family (more fruit)

    So i would love a solution that makes it easy to do.

    Anyone else has an idea?

    I'll upload an capx later if someone will take a look at it.

  • Unfortunately I don't have a solution for this, and can't even try to find one now, I'm on a mac. Sorry

  • No problem, but thanks anyways! it was nice of you

  • xanxion

    you should just give the fruits family a variable fruittype = "lemon" or "otherfruit"

    on click family fruits // this picks one fruittype

    compare familyvar fruittype

    fruittype = "lemon"

    subevent : system: pick all fruits(family) // this resets the "onclick" picking to all fruittypes

    family fruittype = lemon (this will pick all fruittypes of lemon)

  • Ahh, so i just make an instance variable on all the objects in the family, and then pick all "instance variable" ?

  • yes but because of the onclick event, you pick one fruittype, so you need to reset this in a subevent and repick with the fruitvariable

    you could save the picked fruitvariable in the onclick event , so you know wich fruit you just clicked from the family and then

    in the subevent family fruittype= "clickedTypevar" // a variable where you save the fruitType you just clicked

    so now it works for all types

  • Thanks a lot for the help, i think this is the best method so far!

    Much apreciated, saved me a lot of time!

    Cheers!

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