这篇文章将为大家详细讲解有关cocos2d-x代码片段有哪些,文章内容质量较高,因此小编分享给大家做个参考,希望大家阅读完这篇文章后对相关知识有一定的了解。
cocos2d-x代码片段积累
1.左右振动动作
CCPointpointL=MenuItem _ buy-GetPosition();
CCPointpointR=MenuItem _ buy-GetPosition();
pointl。x-=3;
pointr。x=3;
CCMoveTo * moveLeft=CCMoveTo : create(0.08,pointL);
CCMoveTo * moveRight=CCMoveTo : create(0.08,pointR);
CCFiniteTimeAction * action=cc sequence : create(moveLeft,moveRight,moveLeft,moveRight,move left,moveRight,NULL);
menuItem _ buy-stop分配();
menuItem_buy-runAction(动作);
2.动作的复制
CCRepeat * action=CCRepeat :3360 create(产卵,50);
CCRepeat * action 2=(CCRepeat *)action-copy()-auto relest();
CCRepeat * action 3=(CCRepeat *)action-copy()-auto relest();
3.动作反转
ccoctioninterval * rot 1=ccrotateb : create(4,360 * 2);
ccoctioninterval * rot 2=rot 1-reverse();
4 .时间表的使用
调用:schedule(schedule _ selector(schedulerautoremove : autoremove),1.0f);
schedule(schedule _ selector(schedulerautoremove : tick),0.5f);
终止
取消计划(schedule _ selector(schedulerautoremove : autoremove));
5.
unschedule all selecters();
6.取屏幕中心宏
# definecornerccp(ccdirector :3360 shared director()-getWinSize().width/2,ccdirector :3360 shared director()-getWinSize().高度/2)关于cocos2d-x代码片段有哪些就分享到这里了,希望
内容来源网络,如有侵权,联系删除,本文地址:https://www.230890.com/zhan/81844.html