Possible Duplicate:
How to convert a CCSpriteFrame to a CCTexture2D (Cocos2d)
Is it possible to take a CCSpriteFrame that was taken from CCSpriteFrameCache, and convert it into a CCTexture2D?
i tried this:
-(id)initWithFile:(NSString*)filename body:(b2Body*)body original:(BOOL)original
{
NSAssert(filename != nil, @"Invalid filename for sprite");
CCTexture2D *texture = [[[CCSpriteFrameCache sharedSpriteFrameCache]spriteFrameByName:filename ]texture];
return [self initWithTexture:texture body:body original:original];
}
but on the screen that shows the entire spritesheet texture not just one frame.
there is a similar question here at this link: How to convert a CCSpriteFrame to a CCTexture2D (Cocos2d)
but I didn’t find the answers to this link helpful.
I also Tried this but I got the same results:
-(id)initWithFile:(CCSpriteFrame*)filename body:(b2Body*)body original:(BOOL)original
{
NSAssert(filename != nil, @"Invalid filename for sprite");
CCSprite * sprite_ = [CCSprite spriteWithSpriteFrame:filename];
CCTexture2D *texture = [sprite_ texture];
return [self initWithTexture:texture body:body original:original];
}
Did you try:
and after that:
?