我不应该继承 Cocos2d CCDirector 类吗?
我正在尝试让 cocos2d 成为 RPG 引擎。我正在考虑创建一个类来协调角色的移动、地图加载/卸载等。我应该为此创建一个 CCNode,还是只是扩展 CCDirector?有没有理由不子类化CCDirector
?
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
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
除了cocos2d中的子类(CCDirectorDisplayLink、CCDirectorTimer等)之外,我从未见过CCDirector的子类。允许创建 CCDirector 的子类,但实际上并不需要。
如果您想要为每个帧调用一个方法,可以使用 CCScheduler -scheduleSelector:forTarget:interval:paused: 方法。它将调用主循环中每一帧的选择器。
CCScene 可以用于加载/卸载资源数据等。
另外,这些教程怎么样?
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.
And CCScene is able to use for loading/unloading resource data, or etc.
Also, how about these tutorials?