Timer problem, first time it counts to 10, 2nd time only to 9, why?

QuestionManQuestionMan Member Posts: 81
edited August 2012 in Working with GS (Mac)
I have a spawner that has the following code:

If 'spawn' = false...
For 10 seconds...
Every 1 second, spawn Monster

after the first loop through (10 spawned and 10 monsters killed), it resets Spawn to false, only this time it only produces 9 monsters, why would it do that?

I played with the 'run to completion' but it didn't change anything

Best Answer

  • tatiangtatiang Posts: 11,949
    Accepted Answer
    If you do the following:

    Timer For 10 seconds --> Timer Every 1 second --> Log Debugging Statement "spawn"

    and then look at the Debugger window, you'll see that only 9 statements are logged.

    For reasons I don't understand, you'll need to add a bit of buffer to the For timer behavior. Usually, it works fine if I do Timer For 10.1 seconds --> Timer Every 1 second --> Spawn

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

Answers

Sign In or Register to comment.