2012-09-14 29 views
1

這是我在堆棧溢出中的第一個問題。骨架動畫 - 如何翻轉FTCCharacter?

我正在玩Cocos2d的骨骼動畫。通過使用TheDamArmada/Flash2Cocos2D庫,我可以初始化一個從CCSprite繼承的FTCCharacter。我嘗試使用myRobot.flipX = YES翻轉整個角色,但它不起作用。

有什麼建議嗎?

這是一個內聯的鏈接到Flash2Cocos2D

謝謝。

回答

0

從cocos2d的來源(CCSprite.h:121)

/** whether or not the sprite is flipped horizontally. 
It only flips the texture of the sprite, and not the texture of the sprite's children. 
Also, flipping the texture doesn't alter the anchorPoint. 
If you want to flip the anchorPoint too, and/or to flip the children too use: 

    sprite.scaleX *= -1; 
*/ 
@property (nonatomic,readwrite) BOOL flipX; 

所以預計FTCCharacter的孩子不翻轉。 myRobot.scaleX *= -1;應該按照Cocos2D的建議工作。

+1

解釋你認爲是OP代碼的問題以及你的解決方案如何解決問題總是一個好主意:)你可能想編輯你的答案並更新它以使它與問題更相關。 – Sujay