How do i set a condition that will set the end of the game?

wroachbarrettewroachbarrette Member Posts: 101
edited November -1 in Working with GS (Mac)
I need to set a condition so that when all the actors of a cretin tag are destroyed that it will move to another sean can you tell me how to do this

Comments

  • BarkBarkCoBarkBarkCo Member Posts: 1,400
    I can think of a few ways you could do this.

    #1 (probably not the best...)

    Add an actor that covers the entire screen area. Turn off the visible attribute and move it to the back of the scene/layer. Add a rule that checks for collision/overlap with actors with the tag you mentioned. In the 'otherwise' section of this rule add the logic for the scene change.

    #2

    Create a global integer attribute (I'll call it `EnemyCount`). In each of your enemy actors, add a logic that increments EnemyCount.

    `Change Attribute: EnemyCount to EnemyCount+1`

    In the logic that destroys the enemy actor, add another `Change Attribute` that decrements EnemyCount, `EnemyCount -1`

    In another actor that is always in the scene (a lot of people have a dedicated "scene control" actor), add logic that checks for `EnemyCount=0`. That would trigger the scene change. You may want to delay this logic with an "after" timer, that would give the increment logic time to build `EnemyCount` above 0.
  • wroachbarrettewroachbarrette Member Posts: 101
    thanks, now is there a way to do the same thing but only if by chance all the actors are destroyed? say that all the enemies and you are destroyed can i have ti change to another sean in that case?
  • wroachbarrettewroachbarrette Member Posts: 101
    barkbark00 said:
    I can think of a few ways you could do this.

    #1 (probably not the best...)

    Add an actor that covers the entire screen area. Turn off the visible attribute and move it to the back of the scene/layer. Add a rule that checks for collision/overlap with actors with the tag you mentioned. In the 'otherwise' section of this rule add the logic for the scene change.

    #2

    Create a global integer attribute (I'll call it `EnemyCount`). In each of your enemy actors, add a logic that increments EnemyCount.

    `Change Attribute: EnemyCount to EnemyCount+1`

    In the logic that destroys the enemy actor, add another `Change Attribute` that decrements EnemyCount, `EnemyCount -1`

    In another actor that is always in the scene (a lot of people have a dedicated "scene control" actor), add logic that checks for `EnemyCount=0`. That would trigger the scene change. You may want to delay this logic with an "after" timer, that would give the increment logic time to build `EnemyCount` above 0.

    How do I add logic to check for this i cant seme to figure this out when i create a rule that says when this is set to 0 it freezes
  • BarkBarkCoBarkBarkCo Member Posts: 1,400
    I'll post a demo of what I am talking about tomorrow afternoon. For now I'm gonna sleep (2 am, yikes!) and then there's my sucky job to contend with....
  • wroachbarrettewroachbarrette Member Posts: 101
    barkbark00 said:
    I'll post a demo of what I am talking about tomorrow afternoon. For now I'm gonna sleep (2 am, yikes!) and then there's my sucky job to contend with....

    ok so do i need to create an intiger attribute?
Sign In or Register to comment.