Reputation: 13
Sorry this is probably a dumb question but I have been struggling with this for a while. I’m kind of new to Cocos2d, but I have a schedule timer set to 3 secs to make a sprite disappear and every time they click the button it adds 3 seconds to the timer, the problem i'm having is when they click the button it wont add 3 seconds to the timer, the timer just ends,
Upvotes: 1
Views: 108
Reputation: 8444
You can also use
[self performSelector:@selector(tick:)withObject:nil afterDelay:3.0];
Upvotes: 0
Reputation: 2512
[_timer setFireDate:[[_timer fireDate] dateByAddingTimeInterval:600]];
This would add 10 minutes (600 seconds) to my _timer.
Upvotes: 2
Reputation: 22042
In cocos2d, its better to use scheduler instead of NSTimer and you can change fire interval time with following api.
[self schedule: @selector(tick:) interval:0.03f];
[self unschedule:@selector(tick:)];
[self schedule: @selector(tick:) interval:0.05f];
Upvotes: 3