Hello guys, this is my first post on this forum and I must say that I am TOTALLY LOST with the example that was posted on the cocos2d wiki for the schedule timer. Here's what they posted.
-(id) init
{
if( (self=[super init] ) ) {
// schedule a callback
[self scheduleUpdate]; // available since v0.99.3
[self schedule: @selector(tick2:) interval:0.5];
}
return self;
}
-(void) update: (ccTime) dt
{
// bla bla bla
}
-(void) tick2: (ccTime) dt
{
// bla bla bla
}
But I'm not sure how to use it. What goes in the update method and what goes in tick2? What is happening here? Why is there an interval of 0.5 for the second tick?
My goal is just to make a variable called GameTime and count the time that has elasped since I started the scene and then post on each second the updated time in my console (basically, I want to print each second using NSLog). Can you guys help?