views:

22

answers:

1

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?

A: 

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.

Rob Segal
What I want to create is actually a sprite with more than 1024 width, so I'm thinking, I need a texture and just create the sprite from there.Is there another way of approaching this problem?
Suzie
Ah ok. For some reason that just wasn't registering in my brain what you were trying to explain. You could certainly create a texture using the 1024x1024 image. I'm pretty sure I worked on a project where we did that. If performance becomes an issue you may have to break up that image and tile the pieces which is what I was thinking in my answer post.
Rob Segal