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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:CCSpriteFrame 警告..AnchorPoint 无法按预期工作.重新生成 .plist?
- 想使用ViewPager,无法识别android.support.*? 2022-01-01
- 使用自定义动画时在 iOS9 上忽略 edgesForExtendedLayout 2022-01-01
- Android viewpager检测滑动超出范围 2022-01-01
- MalformedJsonException:在第1行第1列路径中使用JsonReader.setLenient(True)接受格式错误的JSON 2022-01-01
- Android - 我如何找出用户有多少未读电子邮件? 2022-01-01
- 如何检查发送到 Android 应用程序的 Firebase 消息的传递状态? 2022-01-01
- Android - 拆分 Drawable 2022-01-01
- 用 Swift 实现 UITextFieldDelegate 2022-01-01
- 在测试浓缩咖啡时,Android设备不会在屏幕上启动活动 2022-01-01
- android 4中的android RadioButton问题 2022-01-01