cocos2d怎么使用定時(shí)器
cocos2d怎么使用定時(shí)器
拉風(fēng)的咖菲貓
2018-12-03 04:04:27
TA貢獻(xiàn)1815條經(jīng)驗(yàn) 獲得超6個(gè)贊
有一下幾種方法:
1.[self scheduleUpdate];
這樣以默認(rèn)cocos2d的刷新頻率1/60.0s走- (void)update:(ccTime)dt一次
停止方法:[self unscheduleUpdate];
2.[self schedule:@selector(tick:)];
這樣以默認(rèn)cocos2d的刷新頻率1/60.0s走- (void)tick:(ccTime)dt一次,tick是自己定義的方法
停止方法:[self unschedule:@selector(tick:)];
3.[self schedule:@selector(secondUpdate:) interval:1.0f];
這樣計(jì)時(shí)器每一秒執(zhí)行一次- (void)secondUpdate:(ccTime)dt一次,secondUpdate是自己定義的方法;
停止方法:[self unschedule:@selector(secondUpdate:)];
舉報(bào)