Stephan Hofmann Stephan Hofmann - 1 year ago 142
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;

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:


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 Source

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.