开发者

Compostion of -schedule:(SEL)selector in Cocos2d

I have a spriteHandler object that composes (has) a CCSprite. It also composes a behavior object that开发者_JS百科 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?


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:

[[CCScheduler sharedScheduler] scheduleSelector:@selector(behaviourMethod) forTarget:self interval:0.1 paused:NO];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜