All enemy destroyed = finish level

fZoleefZolee Member, PRO Posts: 34

I'm trying to make a game where if you kill all enemy on the level then you won, but couldn't figure out how to do it exactly.

What I have is a game level "all enemy destroyed" boolean attribute, a Hero with a rule if that attribute is true then go to Victory scene and Enemy actors with a change "all enemy destroyed" attribute to false. I was trying to add a constrain attribute to my Hero actor but then instantly won the game.

My question is how would I change the "all enemy destroyed" attribute to true only when there are no Enemy actor left?
Thanks a lot in advance anyone can help.

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    In each enemy actor:

    Change Attribute game.enemyCount (integer) to game.enemyCount + 1
    When [enemy is going to be destroyed]
         Change Attribute game.enemyCount to game.enemyCount - 1

    In a separate actor:

    Timer after 0.1 seconds
         When attribute game.enemyCount is 0
              [finish level; change scene etc.]

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • fZoleefZolee Member, PRO Posts: 34

    Thank a lot for the superfast and very clear and helpful reply, it is working now! ;)

Sign In or Register to comment.