开发者

How can I create a texture from an AtlasSpriteManager?

开发者 https://www.devze.com 2022-12-23 08:51 出处:网络
What I want to do is create a huge texture(w/ width of more than 1024) using开发者_如何学运维 a 1024x1024 image. I can retrieve the images using an AtlasSpriteManager, but whenever I try to retrieve t

What I want to do is create a huge texture(w/ width of more than 1024) using开发者_如何学运维 a 1024x1024 image. I can retrieve the images using an AtlasSpriteManager, but whenever I try to retrieve the texture from the manager I can only get the first image.

I need to set the position of every AtlasSprite in the manager to make a lengthy texture.

Any suggestions?


Sounds like you want to create a tiled texture. Quite sure Cocos has a specific API for that but I would check their documentation and ask on the forum over there to be sure.

UPDATE: I did create a working solution for this issue for a game I am working on which was to create an array of all the textures you want to use as the larger background. Position them so they are side by side when added into Cocos2D. With this initial placement the images will look like they are one big background. This works wonderfully and you can see the result in the game Addicus for iPad when Apple approves it which should hopefully be soon. Addicus is using six 1024x768 textures for the background. Two things to keep in mind with this solution...

  • When you move any of the the tiled images (which you no doubt will be) you will need to move all the tiles by the same amount and in the same direction. This prevents the tiles from breaking apart and ruining the illusion of a large background

  • You will likely notice a gap between tile pieces as you move the background pieces. To eliminate this make the tiles overlap by 1 pixel.

0

精彩评论

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