I create a game, the background color is white, starting with this:
self.backgroundColor = SKColor.whiteColor()
So, when the game starts white, this is the background. I have a scoring system, so basically I want the colors to change when a certain result is achieved:
if score < 100{
enemy.runAction(SKAction.moveTo(mainBall.position, duration:3))
}
else if score >= 100 && score < 200{
enemy.runAction(SKAction.moveTo(mainBall.position, duration:2.5))
self.backgroundColor = SKColor.purpleColor()
}
else if score >= 200 && score < 300{
enemy.runAction(SKAction.moveTo(mainBall.position, duration:2))
self.backgroundColor = SKColor.greenColor()
}
However, this method is very awkward and looks pretty awful if I'm honest. Everything in my game is fluid and contains attenuation when removed from the scene using:
livesLabel.runAction(SKAction.fadeInWithDuration(0.5))
But I'm not sure how I will do this with the background color. If I use the above example with backgroundColor like
self.backgroundColor = SKAction.fadeInWithDuration(SKColor.purpleColor())
I get the error "Can't call" fadeInWithDuration "with an argument list of type" (UIColor) "
. , . ,