Question about timer

SANDEEP410SANDEEP410 Member Posts: 46
edited May 2012 in Working with GS (Mac)
I want my enemies to respawn when last enemy is dead.
Currently my enemies spawn instantly when last enemy is dead.
So i put all spawn actor inside a timer of 1sec but now enemy dont spawn when last enemy is dead however if i move spawn command from timer the enemys spawn.
How to make enemy spawn after 1sec when last enemy is dead and why is it not happening when i use timer

Best Answers

  • MarkOnTheIronMarkOnTheIron Posts: 1,447
    Accepted Answer
    A destroyed actor can't spawn something. I modified the demo a little for you. Is that what you were looking for?

    http://dl.dropbox.com/u/8244920/testdemo.gameproj.zip
  • tatiangtatiang Posts: 11,949
    edited June 2012 Accepted Answer
    @SANDEEP410 The key here is that you need a separate, invisible actor that watches the value of game.ballcount and then spawns the actor when appropriate. That kind of rule should never be on the gameplay actor itself, especially if you are destroying that actor. And one more suggestion: always have the Destroy behavior at the end of your rule or list of behaviors. If Destroy is listed before something else (in your case, Change Attribute game.ballcount to game.ballcount-1), it won't always work because the actor may be destroyed before/at the same time as that behavior attempts to run.

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

Answers

Sign In or Register to comment.