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

查看:176
本文介绍了在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 :)

推荐答案

您不能使用大于1024x1024或2048x2048的纹理用于iphone / ipod 4 。因此,渲染这样大的图像的唯一方法是渲染它的部分。

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).

也许你可以使用Parallax背景。如果是这样 - 使用它。

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天全站免登陆