Reputation: 1070
I have a variable called duration which is a NSTimeInterval(3). 3 is the number of objects on the screen and the new object begin to fall when the last is at the bottom of the screen. I want this number reduce, because it will fall faster when there will be less objects. I want it reduce every time the score is increased by 5 from last reduce. But if I write there this code it does nothing:
if ((self.score % 5) == 0) {
self.duration--
}
How can I do it?
Thanks
Upvotes: 1
Views: 164
Reputation: 6604
I guess the "Swifty" answer would be something like this:
var score:Int {
didSet {
self.duration--
}
}
That said you haven't really given enough info to say why self.duration--
would not work, so I'm assuming that code just isn't being called.
Upvotes: 1