1

I'm trying to make cocos2d work as an RPG engine. I'm thinking of making a class that will coordinate the movements of the characters, the map loading/unloading etc. Should I make a CCNode for this, or just extend the CCDirector? Is there a reason not to subclass the CCDirector?

4

1 回答 1

1

I have never seen a subclass of CCDirector except the subclasses in cocos2d (CCDirectorDisplayLink, CCDirectorTimer or so on). Subclasses of CCDirector are allowed to create, but it is not really needed.

If you want a method that is invoked for every frame, you can use CCScheduler -scheduleSelector:forTarget:interval:paused: method. It will invoke the selector for every frame from the main loop.

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

And CCScene is able to use for loading/unloading resource data, or etc.

Also, how about these tutorials?

于 2011-06-02T13:57:22.257 回答