Spawning unique instances

0 favourites
  • 5 posts
  • Urgh, so I am a new user and cant post URLS yet so hopefully this is clear enough.

    I am using 'Create Object' to spawn 2 objects, a Parachute & an Item attached to the Parachute with Pin.

    When I click on the Parachute it gets destroyed and drops the item to the ground.

    This all works perfectly.

    BUT

    I have it so that every 3 seconds a new Parachute/Item object set gets created.

    when I have multiple of these on screen at once, and I click on one of them ALL of them drop the item & get destroyed.

    Is there a correct way I should be doing this so they all act independently of each other, whilst still using the On Click action?

  • You need to keep track of the UID that you are pairing the item/parachute to. Add an instance variable to the parachute, set it to the UID of the item, then on-click, do a Pick by UID for the item so the correct one is selected.

  • You can check if each object "Is pinned" and if it's not, drop it to the ground.

    edit: you can post the URL, just leave out the colon or the slashes for us to fill in.

    (you can probably get to 500 rep real fast too. See the easier rep to earn here: https://www.scirra.com/me/rep )

  • You are not using the good condition :

    It's not on click, it's on object clicked you should be using.

    Something like this :

    Mouse => on object clicked => parachute => parachute destroy

    Only the clicked parachute will be destroy.

    if you use :

    Mouse => on click => parachute destroy

    it will of course destroy all parachutes

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for the replies, will check out the UID stuff sounds like the way to go!

    You are not using the good condition :

    It's not on click, it's on object clicked you should be using.

    Something like this :

    Mouse => on object clicked => parachute => parachute destroy

    Only the clicked parachute will be destroy.

    if you use :

    Mouse => on click => parachute destroy

    it will of course destroy all parachutes

    I am using on click - parachute, but it doesn't identify them as unique currently.

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