Is it possible to convert a CCSpriteFrame
that was taken from CCSpriteFrameCache
, and convert it into a texture that can be set on a sprite texture pro
Assuming your CCSpriteFrame is named frame
you can use:
[sprite setDisplayFrame:frame];
to change the sprite's frame if it uses the same texture. If the texture is not the same, you must create a new sprite:
CCSprite* sprite = [CCSprite spriteWithTexture:frame.texture];
[sprite setDisplayFrame:frame];
But since you already have the CCSpriteFrame you can just as well call initWithFrame:
CCSprite* sprite = [CCSprite spriteWithSpriteFrame:frame];
Yes, it has a texture
function:
[[[CCSpriteFrameCache sharedSpriteFrameCache]spriteFrameByName:@"MyFrame"]texture];
CCSprites have a method called setTexture
or something.