Hi how can i use CCTimer to call a function after 5 seconds and I don't want to repeat the function.
thanks
A fast, easy to use, free, and community supported 2D game engine
Hi how can i use CCTimer to call a function after 5 seconds and I don't want to repeat the function.
thanks
//Pseudo code
//in init
int callCount = 0;
[self schedule:@selector(myMethod:) interval: 5.0f]; //the timer will start NOW not after five seconds but just read the next lines
-(void)myMethod:(ccTime)dt { //mayby you could use <- the dt variable
if(callCount == 1) {
//do my stuff cause 5 seconds are past
[self unschedule:@selectors(myMethod:)];//dont forget this
callCount = 0
} else {
callCount++;
}
}
.....
option 2:
//pseudo code //in init method
[self runAction:[CCSequence actionWithActions [CCDelay delayWithDelay: 5], CallFunc(@selector(method:)]];//just search in forum how to use ccdelay
Hope it helps a little bit
edit: ohh didn't see that you want a cctimer
You must log in to post.