Saturday, May 16, 2015

cocos2d android Java 游戲開發基礎 8 - CCAction 初步 (四)學習視頻筆記

資料來源: 千鋒獨家出品《Android遊戲開發基礎視頻教程》http://www.mobiletrain.org/about/news/android_video3.html

* CCFadeIn 與 CCFadeOut
    CCFadeIn ccFadeIn = CCFadeIn.action(3);
    player.runAction(ccFadeIn);
    CCFadeOut ccFadeOut = CCFadeOut.action(3);
    player.runAction(ccFadeOut);

* CCTintTo 與 CCTintBy
    ccColor3B color3b = ccColor3B.ccc3(0, 0, 255);
    CCTintTo ccTintTo = CCTintTo.action(3, color3b);
    player.runAction(ccTintTo);

    ccColor3B color3b = ccColor3B.ccc3(-120, -255, -120);
    CCTintBy ccTintBy = CCTintBy.action(3, color3b);
    player.runAction(ccTintBy);

* CCRepeat
    CGPoint cgPoint = CGPoint.ccp(100, 300);
    CGPoint targetPoint = CGPoint.ccp(400, 300);
    CCMoveTo moveTo1 = CCMoveTo.action(2, targetPoint);
    CCMoveTo moveTo2 = CCMoveTo.action(2, cgPoint);
    CCSequence ccSequence = CCSequence.actions(moveTo1, moveTo2);

    CCRepeat ccRepeat = CCRepeat.action(ccSequence, 3);
    player.runAction(ccRepeat);

* CCRepeatForever
    CCRepeatForever ccRepeatForever = CCRepeatForever.action(ccSequence);
    player.runAction(ccRepeatForever);

No comments: