我是cocos2d的noob,隨着我的發展而學習。我閱讀了cocos2d文檔,也從Ray Wenderlich教程中,嘗試創建spritesheet,但到目前爲止,我無法從我創建的spritesheet中加載任何我的精靈。直接使用普通CCSprite spriteFromFile時,精靈顯示正常。無論如何,我在Zwoptex中創建了spritesheet。我選擇了png文件和座標作爲Cocos2d .plist。將這兩個文件(png和plist)拖放到我的項目資源組中,然後在init方法中編寫下面的代碼。Cocos2d Spritesheet not loading(spriteWithSpriteFrameName)
[[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:@"piece.plist"];
CCSpriteBatchNode *pieceSpriteSheet = [CCSpriteBatchNode batchNodeWithFile:@"piece.png"];
[self addChild:pieceSpriteSheet];
CCSprite *block = [CCSprite spriteWithSpriteFrameName:@"pieceB1.png"];
我已籤文件,資本的名字,甚至重拍的spritesheet很多次,但仍然cocos2d中無法加載pieceB1.png,儘管它已經是那裏的plist和PNG。 這裏的plist文件的截圖:
錯誤我:
2013-02-11 01:33:04.808 sequence[5787:12203] cocos2d: CCSpriteFrameCache: Trying to use file 'piece.png' as texture
2013-02-11 01:33:04.815 sequence[5787:12203] cocos2d: CCSpriteFrameCache: Frame 'pieceB1.png' not found
2013-02-11 01:33:04.818 sequence[5787:12203] cocos2d: Frame interval: 1
2013-02-11 01:33:04.822 sequence[5787:12203] Application windows are expected to have a root view controller at the end of application launch
2013-02-11 01:33:04.822 sequence[5787:12203] cocos2d: surface size: 640x960
2013-02-11 01:33:07.044 sequence[5787:12203] cocos2d: CCSpriteFrameCache: Frame 'pieceG1.png' not found
2013-02-11 01:33:07.045 sequence[5787:12203] *** Assertion failure in +[CCSprite spriteWithSpriteFrameName:]
感謝。
你確定你正在將文件添加到你的項目嗎?' – bluestunt 2013-02-10 18:10:59
是的,我補充說,我認爲:http://i.imgur.com/seAnufn.png – GeneCode 2013-02-10 18:17:24