我有一个母鸡的三个简单图像,我试图使用ray wenderlich的非常好的教程来制作动画(母鸡行走)
http://www.raywenderlich.com/1271/how-to-use-animations-and-sprite-sheets-in-cocos2d
但我一次又一次地收到此警告,并且屏幕上没有出现精灵 在CCSpriteFrame上找不到原始宽度/高度。 AnchorPoint无法按预期工作。重新生成.plist 我尝试调整大小和解开,但错误仍然存在......我无法弄清楚问题?继承我的代码
[[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];
答案 0 :(得分:1)
转到 Zwoptex 菜单,选择参考...
选择精灵表标签
将“坐标格式”更改为 cocos2d ,而不是 Zwoptex Generic