cocos2d-iphone – Cocos2d只安排一次
发布时间:2020-12-14 17:29:52 所属栏目:百科 来源:网络整理
导读:如何只制作一次cocos2d计划选择器?现在我能做的最好的事情是: [self schedule:@selector(eventHappend:) interval:2]; 和eventHappend: - (void)eventHappend: (ccTime) dt{ [self unschedule:@selector(eventHappend:)]; // Do stuff} 但这似乎是一种解
如何只制作一次cocos2d计划选择器?现在我能做的最好的事情是:
[self schedule:@selector(eventHappend:) interval:2]; 和eventHappend: - (void)eventHappend: (ccTime) dt { [self unschedule:@selector(eventHappend:)]; // Do stuff } 但这似乎是一种解决方法……有一种方法只能安排一次吗?
您可以在节点上运行一系列操作,一个CCDelay后跟一个调用您的方法的CCCallFunc.
像这样… [self runAction:[CCSequence actions:[CCDelayTime actionWithDuration:2],[CCCallFunc actionWithTarget:self selector:@selector(eventHappened)],nil]]; (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |