Select one of five instances - how?

0 favourites
  • 2 posts
From the Asset Store
Vector illustration of five spaceships applied to games, websites, applications, covers, and many others!
  • I have one object titled "bar"

    I have five instances of the "bar" object in my game

    When I click on instance 1 of "bar" I want action set 1 to fire

    When I click on instance 2 of "bar" I want action set 2 to fire

    When I click on instance 3 of "bar" I want action set 3 to fire

    Why is this so complicated? So many questions regarding this, but no simple or clear answers. Certainly not trying to be critical (as Construct Rocks!), but this seems to be as fundamental of a expectation as any. Can I name my instances? And then simply identify or call them via onMouseClicked --> "instance name 1" --> perform actions?

    Perhaps this is one of the "would like to have features?"

    Please help - Thank you graciously in advance.

    Davo

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The best solution would be to add an instance variable ID to the Bar sprite and set it to 1,2,3,4,5 for your five instances.

    Then you can change your event to:

    Mouse on clicked Bar 
     Bar ID = 1 -> set fire to 1
     Bar ID = 2 -> set fire to 2
     Bar ID = 3 -> set fire to 3
    ...
    

    Or even easier:

    Mouse on clicked Bar -> set fire to Bar.ID
    

    You can also use UIDs or IIDs

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