2014-09-22 77 views
0

爲了在cocos2d-x 3.2英寸創建一個動畫我這樣做:Spritesheet動畫帶有刻度的框架

SpriteFrameCache* cache = SpriteFrameCache::getInstance(); 

    Vector<SpriteFrame*> animFrames(15); 

    for(int i = 1; i <= 7; ++i) 
    { 
     SpriteFrame* frame = cache->getSpriteFrameByName(String::createWithFormat("%d.png", i)->getCString()); 
     animFrames.pushBack(frame); 
    } 


    auto animation = Animation::createWithSpriteFrames(animFrames, 1/animFrames.size()); 
    auto animate = Animate::create(animation); 
    pSprite->runAction(animate); 

但現在我需要一些幀,以創建鏡像圖像與-1 scaleByX。 SpriteFrame還沒有scale方法。我也不能scalepSprite因爲只有一些幀應該縮放。我怎麼解決這個問題?

+0

動態縮放,或者您想要完全創建一個新的動畫? – 2014-09-25 20:50:11

+0

新的動畫是好的! – Narek 2014-09-26 06:44:00

回答

0

你有一個非常奇怪的情況:)

  1. 您可以安排在精靈的更新選擇並設置flipX根據您所需的條件真/假。 這是我個人的偏好。

  2. 你沒本事SpriteFrame這樣,但你可以使用渲染紋理:http://www.cocos2d-x.org/reference/native-cpp/V3.0alpha0/d9/ddc/classcocos2d_1_1_render_texture.html - 翻轉你想要的精靈在一個新的紋理,基本上實時生成一個新的精靈表。 現在這是一個壞主意。

+0

我有一個反饋,在這種情況下,我使用骨骼動畫。你認爲@Vorren? – Narek 2014-09-26 06:43:20