So here's what I'm trying to do:
Create a sprite from the atlas I read into CCSpriteFrameCache (working fine.)
Add an animation to the sprite - I can also get this working fine but...
The animation is created by loading up a number of CCSpriteFrames, which in turn are reading in CCTextures from a shared CCTextureCache as their assets. It works, but I'm not convinced it's the best way. Seems like I should be loading those CCSpriteFrames with elements of the atlassprite I already loaded in CCSpriteFrameCache.
Question is: is there a method or way of loading those CCSpriteFrames with CCSprites named in the frames of CCSpriteFrameCache?
Open to the idea that I'm going about this wrong. Thanks for any tips.
Code here:
CCAnimation *thingAnimation = [CCAnimation animationWithName:@"wiggle" delay:0.1f];
//this works but I want to get the CCTexture from CCSpriteFrameCache....
aTexture = [[CCTextureCache sharedTextureCache] addImage:@"moon.png"];
//because CCSpriteFrame will only accept a CCTexture
frame1 = [CCSpriteFrame frameWithTexture:aTexture rect:CGRectMake(0, 0, aTexture.pixelsWide, aTexture.pixelsHigh) offset:ccp(0,-40)];
[thingAnimation addFrame:frame1];