Why do families seem to spawn differently than objects?

0 favourites
  • 9 posts
From the Asset Store
A collection of various zombie characters sprites for creating a 2D platformer or sidescroller game
  • Boolean is true => spawn potion, add 1 to family 1 var, set boolean to false.

    Boolean is true => spawn family 1, add 1 to family 1 var, set boolean to false.

    Both of these events should be the exact same. But only the event with the coin object actually adds to the variable.

    Do families spawn differently than non family sprites?

  • Boolean is true => spawn coin, add 1 to family 1 var, set boolean to false.

    Boolean is true => spawn family 1, add 1 to family 1 var, set boolean to false.

    Both of these events should be the exact same.

    No, in the first case the variable will be increased for all family instances, not the one that you've just created.

    .

    If you are creating a new "Coin" instance, you need to use "Coin" in other actions in the same event.

    If you are creating a new "Family" instance, you need to use "Family" in other actions in the same event.

  • I posted a picture and I'm using the "family" variable. But only when i specifically spawn a potion(changed object to match the picture) will the family variable actually count up.

    I could be misunderstanding what you mean though.

  • What family do you spawn? The same "TilesObj.." family?

    When you create a new instance (object or family, doesn't matter), this instance is automatically picked in this event. So all other actions in the same event will affect only one newly created instance.

    However, on your screenshot you are creating PotionObj object. But then you are changing the variable for TilesObj family, which is not picked, so the variable is changed for all existing family instances on the layout..

    Example:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The potion is in tilesobjects family.

    But the variables dont count upwards at every true boolean condition. Unless i spawn a specific object instead of spawning a family. Following this picture the turn variable should add 1 to every family instance created every 2 seconds right?

  • In your last screenshot Turn variable will only increase for one instance, that has been created.

    See examples in my previous comment.

  • Ok then so i don't seem to know how to increase a variable for all instances at the same time. I made a separate event that just adds 1 to the family variable and nothing changes.

    Every 1 second => add 1 to family variable

    That should add one to each family instance that is currently created no? If not than it should add 1 to a single instance, which when ran nothing happens.

    I added actions to 3 events where they should add 1 to the "turn" family variable.

    But only 1 event actually adds 1 to any variable, that being the first one on every 1 second.

  • I fixed it. All i had to do was add 1 to turn before creating an object so it didn't pick the created object only. Thanks so much for the help.

  • Why do you need two events and EndTurn variable? Why don't you increase Turn and create a new instance in the first event (Every 1 second)?

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