I have a CCSprite that is initialized with [CCSprite spriteWithSpriteFrameName:@"plist_file_key_here.png"] . I already added all the sprites from my plist file to CCSpriteFrameCache. I tried to adjust the texture as follows:
CCSpriteFrame * frame = [[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:name]; NSAssert(frame.texture!=nil, @"frame.texture can't equal nil");
As I said in my comments, this does not work. I think this has something to do with the difference between using [CCSprite spriteWithFile:] and [CCSprite spriteWithSpriteFrameName:] , which relies on sprite frames loaded into CCSpriteFrameCache from the texture atlas. When using sprites loaded from a texture atlas, the texture of each sprite is equal to the texture of the sprite sheet. Is there a way around this or do I need to delete and recreate the sprite? If this is my only option, is there a way to remove ccnode from its parent, but save its children?
source share