在 cocos2d 中加载大背景图片大背景、加载、图片、cocos2d

由网友(社会气质姐)分享简介:我正在开发一个使用 cocos2d 和 box2d 开发的 iphone 平台游戏,它必须使用非常大的图像作为背景,我的问题是:Im working on an iphone platforms game developed using cocos2d and box2d which has to use a ver...

我正在开发一个使用 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.

阅读全文

相关推荐

最新文章