问题
i have three simple images of a hen which i am trying to animate(hen walking) using a very good tutorial by ray wenderlich
http://www.raywenderlich.com/1271/how-to-use-animations-and-sprite-sheets-in-cocos2d
but i am getting this warning again and again and no sprite shows up on the screen original Width/Height not found on the CCSpriteFrame. AnchorPoint won't work as expected. Regenerate the .plist i tried resizing and untrimming but the erro persists...i cannot figure out the problem?? heres my code
[[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:@"hentry.plist"];
CCSpriteBatchNode *spriteSheet = [CCSpriteBatchNode batchNodeWithFile:@"hentry.png"];
[self addChild:spriteSheet];
// Load up the frames of our animation
NSMutableArray *walkAnimFrames = [NSMutableArray array];
for(int i = 2; i <= 3; ++i) {
[walkAnimFrames addObject:[[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:[NSString stringWithFormat:@"%d.png", i]]];
}
CCAnimation *walkAnim = [CCAnimation animationWithFrames:walkAnimFrames delay:0.1f];
// Create a sprite
CGSize winSize = [CCDirector sharedDirector].winSize;
self.bear = [CCSprite spriteWithSpriteFrameName:@"2.png"];
_bear.position = ccp(winSize.width/2, winSize.height/2);
self.walkAction = [CCRepeatForever actionWithAction:[CCAnimate actionWithAnimation:walkAnim restoreOriginalFrame:NO]];
[_bear runAction:_walkAction];
[spriteSheet addChild:_bear];
回答1:
Go to Zwoptex menu, select References...
Select Sprite Sheet tab
Change "Coordinates Format" to cocos2d instead of Zwoptex Generic
来源:https://stackoverflow.com/questions/4322135/ccspriteframe-warning-anchorpoint-wont-work-as-expected-regenerate-the-plist