2010-12-01 28 views
1

我有一隻母雞,我自己用的是非常好的教程由射線wenderlichCCSpriteFrame警告..AnchorPoint不能按預期工作。重新生成.plist?

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]; 

回答

1

轉到Zwoptex菜單,選擇引用...
選擇精靈表標籤 更改 「座標格式」,以的cocos2d,而不是Zwoptex通用

alt text

+0

In v Cocos2D的0.99.4和Zwoptex的1.16,看來導出到Cocos2D座標不起作用。我設法通過導出到Zwoptex Flash版本來生成正確的.plist文件。如果這不起作用,則手動導出紋理和座標(文件>導出紋理,文件>導出座標)作爲Zwoptex Flash。 – dianovich 2010-12-20 13:02:05