How to quickly stop updating a sprite set?

override func update(currentTime: NSTimeInterval) {
    // ... 
}

      

When my game is over, I want to stop updating the sprite bundle.

Which function should I use in swift?

+3


source to share


1 answer


You can use bool

to do this, for example, when your game just does it true

and put an if condition in your update method, for example:

override func update(currentTime: NSTimeInterval) {
    // It will execute till gameOver is false but when you make your gameOver true then it will not execute.
    if !gameOver {

        //Do your stuff
    }
}

      



Hope this helps you.

+3


source







All Articles