Reputation:
So I have this very simple game that I want to increase the spawn time when the user gets a score of 10. I need to keep increasing the delayBubbleSpawn_action every 1 second for every 10 points the user gets. How do I do this? I tried using the case statement but it is not working.
func movingEverything() {
//Modify this to increase every 1 second for every 10 points
let delayBubbleSpawn_action = SKAction.waitForDuration(delayBubbleSpawn)
//Need to modify this block of code
runAction(SKAction.sequence([SKAction.runBlock(addCones),
SKAction.repeatActionForever(SKAction.sequence([SKAction.runBlock(addBubbles),
delayBubbleSpawn_action]))]))
runAction(SKAction.repeatActionForever(SKAction.sequence([SKAction.runBlock(lifeBubble),
SKAction.waitForDuration(10.0)])))
}
Upvotes: 0
Views: 71
Reputation: 4254
Probably something like this will do:
var delayBubbleSpawn = INITIAL_DELAY + points%10
It starts with a spawn time of INITIAL_DELAY
and increments it by one every 10 points
.
Upvotes: 1