CCSpriteFrame warning..AnchorPoint won#39;t work as expected.Regenerate the .plist?(CCSpriteFrame 警告..AnchorPoint 无法按预期工作.重新生成 .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
但我一次又一次地收到此警告,屏幕上没有显示任何精灵在 CCSpriteFrame 上找不到原始宽度/高度.AnchorPoint 不会按预期工作.重新生成 .plist我尝试调整大小和取消修剪,但错误仍然存在……我无法找出问题所在??这是我的代码
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菜单,选择References...
选择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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!