In Cocos2d documents it is written that it is not a good idea to use NSTimer. Why is it not recommended to use NSTimer. I know there is a schedule method of Cocos2d.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Try NOT to use Cocoa’s NSTimer. Instead use cocos2d’s own scheduler.
If you use cocos2d scheduler, you will have:
CCLayer (CCScene, CCSprite, CCNode)
enters the stage the timer will be
leaves the stage it will be
target/selector will be called with a
delta time
from here (old broken link)
http://www.cocos2d-iphone.org/wiki/doku.php/prog_guide:best_practices
updated link
http://ec2-50-16-191-191.compute-1.amazonaws.com/wiki/doku.php/prog_guide:best_practices
I would add you are adding some unwanted overhead too. If you have a lot of timers that could be a good bit of overhead.