Loading large background images in cocos2d

核能气质少年 提交于 2019-12-08 06:38:01

问题


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:

-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??

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


回答1:


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.

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



来源:https://stackoverflow.com/questions/5003429/loading-large-background-images-in-cocos2d

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!