How do I make a team system? Similar to super smash brothers

  • Hi All,

    I am making a 4 player couch co-op fighting game. Everything was going great until I got to the win conditions.

    Since each player can choose: red team, blue team, or solo.

    I am stumped on how to create the win condition....

    I feel like arrays will be the answer some how. Just not sure on the logic....

    To recap.

    Choose character, choose team. Fight.

    Players die off.

    Now how do I detect which players are victorious?

    Note, I am using the Health add-on

    scirra.com/store/construct2-behaviours/health-2133

    related Player instance variables

    Health; collective team health; team choice

    possible combinations

    Players: 2-4

    Teams: Red, Blue, Solo P1, Solo P2, Solo P3, Solo P4

    Teams can be:

    3v1

    2v2

    2v1

    2 v 1 v 1

    1 v 1

    1 v 1 v 1

    1 v 1 v 1 v 1

    As you can see, there are a lot of possible combinations.... so logic is required to sort it all out.

    Please advise on the logic :)

    Faux code is appreciated.

    I consider myself an advanced user.

  • Loads of ways to do it. I would do it by having 2 global variables and instance variables on the characters for red/blue which you already have. When they pick red add 1 to red global var, or blue add 1 to blue global var. When character dies check their team, compare if its red then subtract 1 from red global var. If red or blue = 0 then the other team wins. You can also use picked count of players with red/blue instance var and use that to compare if greater than 0. The logic applies to any of those combinations given because it's just counting R v R v B or B v B v R, doesn't really matter.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Nice, I see where you are going with this.

    Thanks!

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