Adding a very simple highscore to cocos2d iphone app using a CCTimer
I'v been looking around on 开发者_开发百科google and I can't find any way to make a highscore app based on a value of a CCTimer. I get that I could try to convert that value to a string or float but i'm not exactly sure how. I read up on cocos live but it doesn't seem to work for me and its a little bigger than I need. I don't need global leaderboards but that would be nice. If someone has any suggestions to start that would be really helpful. If anyone needs my source code I can post that for you too. Thanks in advance.
If i get what you mean, you are trying to make a score based on the amount of time passed..
Add a variable.. If you call your ccTimer every 0.03 seconds, you can do something like this in the function that you called:
-(void)tick:(ccTime)delay
{
timePassed +=0.03;
//blah blah blah
}
So when you need to get the score based on time passed, just read the timePassed variable..
精彩评论