Cocos2d中-schedule:(SEL)选择器的组成
我有一个 spriteHandler 对象,它组成(有)一个 CCSprite。它还组成一个行为对象,该对象具有方法 -update:(ccTime)dt
和返回 @selector(update:)
的方法 -updateSelector
代码>.在 spriteHandler 对象中,我想使用由 CCSprite 实现的方法 -schedule:(SEL)selector
。调用[sprite Schedule:[behavior getUpdateSelector]]
失败;如果你子类化 CCNode,我只能弄清楚如何安排某些事情。有没有办法通过组合来做到这一点?
I have a spriteHandler object that composes (has) a CCSprite. It also composes a behavior object that has a method -update:(ccTime)dt
, and a method -updateSelector
that returns @selector(update:)
. In the spriteHandler object, I want to use the method -schedule:(SEL)selector
, implemented by CCSprite. The call [sprite schedule:[behavior getUpdateSelector]]
fails; I can only figure out how to schedule something if you subclass CCNode. Is there any way to do this through composition?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您想只运行一次还是每帧运行一次?你是什么意思,它失败了?
如果
[sprite Schedule:@selector(behaviourMethod)]
不起作用,请尝试以下操作:Do you want to run something just once or every frame? what do you mean, it fails?
In case
[sprite schedule:@selector(behaviourMethod)]
doesn't work try this instead: