How to go through all the instances in a family when they are not in the layout...

0 favourites
  • 5 posts
From the Asset Store
A collection of various zombie characters sprites for creating a 2D platformer or sidescroller game
  • Hello!

    I was trying to come with an automatic way to check and set this instance variable "owned" for my instances inside this family. It does work, however, when the instances are deleted it skips them and the owned value gets 'misplaced'. I was wondering if there was a way to go through all of them regardless? Or it will cause an error because the object is not on scene? Any idea on how to do this differently? I was resigned to try to add them manually :( Thank you!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It should work if you give them a Family instance variable number as the identifier and run for each ordered by variable.

  • It should work if you give them a Family instance variable number as the identifier and run for each ordered by variable.

    Thank you for your response!

    I actually have an instance with a number asigned to each one, I don't know if you referred to something like this? This example in the photo doesn't work, it has the same problem as the previous approach :/ When any of the outfits is deleted from the scene, it 'jumps' it, and misplaces the "owned" :/

  • On the action you can use "Outfit"&self.number you don't need this counter variable. Same with HasKey move it down below the For and use Outfit&self.number. It won't be out of sync anymore because it's running through all existing instances of Family and using its own variable.

  • On the action you can use "Outfit"&self.number you don't need this counter variable. Same with HasKey move it down below the For and use Outfit&self.number. It won't be out of sync anymore because it's running through all existing instances of Family and using its own variable.

    Thank you!! this worked like a charm!

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