0

我有一个组成(拥有)CCSprite 的 spriteHandler 对象。它还组成了一个行为对象,该对象具有一个方法-update:(ccTime)dt和一个-updateSelector返回方法@selector(update:)。在 spriteHandler 对象中,我想使用-schedule:(SEL)selector由 CCSprite 实现的方法。调用[sprite schedule:[behavior getUpdateSelector]]失败;如果您将 CCNode 子类化,我只能弄清楚如何安排一些事情。有没有办法通过组合来做到这一点?

4

1 回答 1

2

您想只运行一次还是每帧运行一次?你是什​​么意思,它失败了?

如果[sprite schedule:@selector(behaviourMethod)]不起作用,请尝试以下方法:

[[CCScheduler sharedScheduler] scheduleSelector:@selector(behaviourMethod) forTarget:self interval:0.1 paused:NO];
于 2011-02-17T19:18:44.637 回答