使用 cocos2d 对大型精灵进行动画处理 (ccspritesheet)

发布于 2024-09-08 17:45:11 字数 193 浏览 2 评论 0原文

我正在使用 Cocos2d 开发一款 iPhone 游戏,其中主角的尺寸约为 194x114。

该动画由 100 多个帧组成,使我的精灵表大于 1024x1024 的限制。显而易见的解决方案是将动画分离到多个文件,并在必要时交换精灵表。虽然可行(我猜),但我不太确定如何实施这个解决方案,有更好的解决方案吗?您使用 Cocos2d 制作大型动画的体验如何?

I'm working on an iPhone game using Cocos2d where the main character is approximately 194x114.

the animation consists of 100+ frames making my spritesheets larger than the 1024x1024 limit. The obvious solution would be to separate the animation to several files and swapping spritesheets when necessary. while doable (i guess) i'm not quite sure how to go about implementing this solution, is there a better solution? what is your experience with large animation with Cocos2d?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

删除会话 2024-09-15 17:45:11

是的,最好的选择(实际上也是唯一的选择)是将单独的动画分解为单独的文件。一种策略是创建一个帮助程序类,该类知道哪些动画位于哪些源文件中并在它们之间进行交换,这样您的主代码就可以担心选择动画而不是弄乱特定的源文件名。

我怀疑您可能会对 CCSprites 添加为 CCSpriteSheet 的子项感到困惑。当在工作表之间交换以更改动画时,只需从一个 CCSpriteSheet 中删除精灵,然后将其添加到包含新动画的 CCSpriteSheet 中即可。

Yes, your best bet (and only option, really) is to break up separate animations into separate files. One strategy is to create a helper class that knows which animations live in which source files and swap between them, so your main code can worry about picking the animation and not messing with specific source file names.

I suspect you may be getting confused by CCSprites being added as a child of a CCSpriteSheet. When swapping between sheets to change animations, just remove the sprite from one CCSpriteSheet and add it to the CCSpriteSheet containing the new animation.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文