开发者

Loading large background images in cocos2d

开发者 https://www.devze.com 2023-02-10 19:17 出处:网络
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:

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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消