2
我想做一個Spritebuilder iPhone遊戲,我的主角人物_player是一個CCNode,他的孩子是一個CCBFile,它持有角色的空閒動畫。Spritebuilder如何以編程方式更改CCNode的動畫(CCB文件)?
我想將此_player的CCBFile更改爲另一個名爲ForwardDash.ccbi的CCBFile,其中包含玩家觸摸屏幕時的「攻擊」動畫。
這就是我想:
//_player is a CCNode, its first child is the CCBFile with the idle animation.
//animar is a pointer to the CCBFile with the ForwardDash animation
CCSprite *wat = _player.children[0];
CCNode *animar = [CCBReader load:@"ForwardDash"];
[wat setSpriteFrame: (CCSpriteFrame*)animar];
它失敗,給我的錯誤:「線程1:信號SIGABRT」
這是因爲animar是CCNode(或子類)實例,而不是CCSpriteFrame – LearnCocos2D