I want to create a CCLayer with an animated tiled background from a larger texture atlas with Cocos2d.
I know how to drop a background in a CCLayer. I know how to create an animated CCSprite. I even know how to handle tiled world maps. But I can’t find a proper way to combine all these elements in the desired form.
How would I do this?
Example case: Let’s say I have a 512×512 texture atlas. On it are six frames drawn next to each other, all of them 32×32, starting from the top left (0.0).
Now I would like my CCLayer’s background to display a tiled image consisting of 10 by 15 tiles. Plus, the tiles themselves should animate with the six frames from the texture atlas.
As a bonus, the animation itself should be controllable. (I want to be able to speed it up, slow it down or reverse it)
You should be able to get the sprite from the tile map
and run a
CCAnimationaction on it.