上次说到,当点击一个menu时,会创建一个新的test,并调用它的runThisTest方法,比如actionTest
@H_404_3@
void ActionsTestScene::runThisTest() { s_nActionIdx = -1; addChild(NextAction()); CCDirector::sharedDirector()->replaceScene(this); }
CCLayer* CreateLayer(int nIndex) { CCLayer * pLayer = NULL; switch (nIndex) { case ACTION_MANUAL_LAYER: pLayer = new ActionManual(); break; case ACTION_MOVE_LAYER: pLayer = new ActionMove(); break;//移动sprite case ACTION_SCALE_LAYER: pLayer = new ActionScale(); break;//缩放sprite case ACTION_ROTATE_LAYER: pLayer = new ActionRotate(); break;//旋转sprite case ACTION_SKEW_LAYER: pLayer = new ActionSkew(); break;//倾斜sprite case ACTION_SKEWROTATE_LAYER: pLayer = new ActionSkewRotateScale(); break;//m_tamara->removeFromParentAndCleanup(true);这个方法可以从父类中移除自己。还有并发action不是得用CCSpawn吗?难道不需要?? case ACTION_JUMP_LAYER: pLayer = new ActionJump(); break;//actionTo和actionBy的区别:前者是跳到这个坐标点,后者是基于原来的位置跳多少距离,比如actionBy(ccp(0,0))就是在原地跳 case ACTION_BEZIER_LAYER:、、 pLayer = new ActionBezier(); break;//贝尔曲线 case ACTION_BLINK_LAYER: pLayer = new ActionBlink(); break;//闪烁 case ACTION_FADE_LAYER: pLayer = new ActionFade(); break;//淡入淡出 case ACTION_TINT_LAYER: pLayer = new ActionTint(); break;//从一种颜色变为另一种 case ACTION_ANIMATE_LAYER: pLayer = new ActionAnimate(); break;//动画 case ACTION_SEQUENCE_LAYER: pLayer = new ActionSequence(); break;//按顺序执行一系列动作 case ACTION_SEQUENCE2_LAYER: pLayer = new ActionSequence2(); break;//action结束可以回调某个方法 case ACTION_SPAWN_LAYER: pLayer = new ActionSpawn(); break;//并发,就是多个动作同时进行 case ACTION_REVERSE: pLayer = new ActionReverse(); break;//执行相反动作 case ACTION_DELAYTIME_LAYER: pLayer = new ActionDelayTime(); break;// CCSequence::actions( move,CCDelayTime::actionWithDuration(2),move,NULL); CCDelayTime::actionWithDuration(2)可以执行延时 case ACTION_REPEAT_LAYER: pLayer = new ActionRepeat(); break;// case ACTION_REPEATEFOREVER_LAYER: pLayer = new ActionRepeatForever(); break;// case ACTION_ROTATETOREPEATE_LAYER: pLayer = new ActionRotateToRepeat(); break; case ACTION_ROTATEJERK_LAYER: pLayer = new ActionRotateJerk(); break; case ACTION_CALLFUNC_LAYER: pLayer = new ActionCallFunc(); break; case ACTION_CALLFUNCND_LAYER: pLayer = new ActionCallFuncND(); break; case ACTION_REVERSESEQUENCE_LAYER: pLayer = new ActionReverseSequence(); break; case ACTION_REVERSESEQUENCE2_LAYER: pLayer = new ActionReverseSequence2(); break; case ACTION_ORBIT_LAYER: pLayer = new ActionOrbit(); break;//每一个CCNode对象都有一个Camera,默认的位置是锚点?所以我们看到的2D图都是规则的,当我们改变Camera的位置时,就会看到这个CCNode对象的不同形状,不知道这样理解对不对 case ACTION_FLLOW_LAYER: pLayer = new ActionFollow(); break; default: break; } return pLayer; }
原文地址:http://www.itmmd.com/201410/70.html
该文章由android开发整理发布,转载须标明出处。。