Stephan Hofmann Stephan Hofmann - 4 months ago 24
Objective-C Question

Cocos2d - Problems with .pvr.ccz spritesheet (incorrect position, blurry) created with TexturePacker

I have a problem by using the .pvr.ccz format. I have a simple spritesheet with a few sprites on it created by TexturePacker. It's loaded like in my example code below.

@implementation MainScene

- (id)init
{
// Apple recommend assigning self with supers return value
self = [super init];

[[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:@"spritesheet.plist"];
CCSprite * sprite = [CCSprite spriteWithSpriteFrame:[CCSpriteFrame frameWithImageNamed:@"play-button.png"]];
sprite.position = ccp(0.5, 0.5);
sprite.positionType = CCPositionTypeNormalized;
[self addChild:sprite];

// done
return self;
}
@end


The spritesheet is loaded and I don't get any warnings or errors in the console. But somehow the sprite (play-button.png) is first of all blurry and on the second hand it's the wrong position on the spritesheet (so it's a half of another sprite and not the playbutton).

In TexturePacker I have the following options selected:

Texturepacker

I read many articles about the advantages of using pvr.ccz. I use the cocos2d version 3.5. So did I miss something in my code or is there an option in Texturepacker?

Answer

At a point in time (memory fails) cocos2d and TP changed the .pvr format (produced and read) to the normal 'flipped' version. Thus, just select the Flip PVR check-box in TP, and the rendering should be fine.