is there a way to have shared variables between families?

Not favoritedFavorited Favorited 0 favourites
  • 4 posts
From the Asset Store
A collection of various zombie characters sprites for creating a 2D platformer or sidescroller game
  • so basically, I have a game with 2 players and also summons

    all players and summons have the same health bar and damage taking mechanic

    so I have the family "allies" with "health" variable, covering all players and summons

    but I also want the 2 players to heal to full health at the end of each game round. but not any summons, so I have the family "2players", but I can't assign health to them, I don't want to assign health to them I just want them to use the health bar variable that they already have

    is there any way to get around having to make a separate event for each player

    (this isn't the only example of this, solving this would save me dozens of events)

  • You would use the health variable on the two player objects. It is the same inherited variable. So instead of set family.health it is player1.health and player2.health. When you don't want to target all things in a family you just pick the single objects.

  • but thats exactly what I'm trying to avoid, thats why my code is cluttered. I don't want copy the same events over and over with only one thing changed

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You could have a family bool like isPlayer and then apply all logic to those with isPlayer=true to group player logic.

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