在 cocos2d 中加载大背景图片 [英] Loading large background images in cocos2d

查看:20
本文介绍了在 cocos2d 中加载大背景图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个使用 cocos2d 和 box2d 开发的 iphone 平台游戏,它必须使用非常大的图像作为背景,我的问题是:

Im working on an iphone platforms game developed using cocos2d and box2d which has to use a very large image as a background, my question is this:

-加载图像的更好方法是什么?(我说的是一个可以长 14K 像素的图像),是否最好切入较小的图像并在玩家移动时继续加载它们??

-which is the better way to load the image?? (I'm talking about an image which can be 14K pixels long), is it better to cut in smaller images an keep loading them as the player moves??

-我应该在内存中保持不可见还是使用 addChild 方法在需要时加载它们并使用 removeChild 删除前一个?

-Should I keep in memory as invisible or use the addChild method to load them as I need them and the removeChild to remove the previous one?

提前致谢,欢迎任何回答:)

Thanks in advance, any answer will be welcome :)

推荐答案

你不能为 iphone/ipod 4 使用大于 1024x1024 或 2048x2048 的纹理(也许 iPad 也是如此).所以渲染这么大的图像的唯一方法是渲染它的部分.

You can't use textures larger then 1024x1024 or 2048x2048 for iphone/ipod 4 (maybe iPad too). So the only way to render such big image is rendering it's parts.

我会尝试在玩家移动时加载部件(最好在单独的线程中).

I would try to load the parts as the player moves (better in a separate thread).

也许你也可以使用视差背景.如果是这样 - 使用它.

Also maybe it is possible for you to use Parallax background. If so - use it.

如果您的图像由许多相同的部分组成,那么使用 CCTMXTiledMap 是个好主意.

If your image is made from a lot of identical parts then it's a good idea to use CCTMXTiledMap.

这篇关于在 cocos2d 中加载大背景图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆