我使用的是cocos2d 2.0
在我的layer类中,我正在调度一个方法
[self schedule:@selector(myMethod:) ];然后在同一层中,我调度另一种方法,如下所示
[[self scheduler]scheduleSelector:@selector(mySecondMethod) forTarget:self interval:enemySpawnSpeed paused:NO];当我运行代码时,它显示'CCScheduler。正在尝试使用与目标不同的暂停值来调度选择器‘。
当我注释这些行中的任何一行时,我的项目运行正常,并且没有给出错误。用同一个节点调度多个选择器是不可能的吗?还是我做错了什么?
在阅读了http://www.cocos2d-iphone.org/wiki/doku.php/prog_guide:draw_update指南后,我不太确定,但我认为我们只能为每个节点安排一个选择器
发布于 2013-07-05 07:32:22
当然,这是可行的:
[self scheduleSelector:@selector(myMethod:)];
[self scheduleSelector:@selector(mySecondMethod:)];您的mySecondMethod选择器末尾缺少冒号。您得到的错误与paused标志有关,您应该使用self.paused而不是NO来确保选择器的paused状态与目标的相同。
另外,第二行很奇怪,你有没有尝试从类的外部安排更新?如果是这样,只需向layer对象(即scheduleMySecondMethod)发送一条消息,然后调度选择器。
https://stackoverflow.com/questions/17478218
复制相似问题