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?
基础教程推荐
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- 如何在 UIImageView 中异步加载图像? 2022-01-01