CCSpriteFrame警告.AnchorPoint将无法正常工作。重新生成.plist? [英] CCSpriteFrame warning..AnchorPoint won't work as expected.Regenerate the .plist?
问题描述
我有一个母鸡的三个简单的图像,我试图动画(母鸡走)使用一个非常好的教程ray wenderlich
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
但我得到这个警告一次又一次,没有sprite显示在屏幕上
在CCSpriteFrame中找不到原始宽度/高度。 AnchorPoint将无法正常工作。重新生成.plist
我试图调整大小和untrimming,但错误仍然存在...我不能弄清楚问题? heres我的代码
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];
推荐答案
前往 Zwoptex ,选择参考...
选择 Sprite Sheet 标签
改为坐标格式为 cocos2d Zwoptex Generic
Go to Zwoptex menu, select References...
Select Sprite Sheet tab
Change "Coordinates Format" to cocos2d instead of Zwoptex Generic
这篇关于CCSpriteFrame警告.AnchorPoint将无法正常工作。重新生成.plist?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!