cocos2d-x 开发常用代码(3.0)

前端之家收集整理的这篇文章主要介绍了cocos2d-x 开发常用代码(3.0)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

转载请注明出处http://blog.csdn.net/wjlpld/article/details/41147457,谢谢~~~~

-------------------------------以下是开发常用代码-------------------------------

-------------------------------帧动画-------------------------------

@H_301_18@Animation* animation = Animation::create(); for (int i=1;i<10;i++) { char szName[100] = {0}; sprintf(szName,"new/0%d.jpg",i); animation->addSpriteFrameWithFileName(szName); } animation->setDelayPerUnit(2.0f /24.0f); animation->setRestoreOriginalFrame(true); Animate* action = CCAnimate::create(animation); bg2->runAction(RepeatForever::create(action));



-------------------------------骨骼动画-------------------------------

@H_301_18@ ArmatureDataManager::getInstance()->addArmatureFileInfo("UI/start_show.ExportJson"); auto start_show = Armature::create( "start_show"); start_show->setPosition(Point::ZERO); start_show->setAnchorPoint(Point::ZERO); start_show->getAnimation()->play("normal"); this->addChild(start_show,1);

l-------------------------------Lamda表达式(用于Sequence)-------------------------------

@H_301_18@CallFunc::create( [&](){ bossAct = MoveTo::create(tileShowTime,Point(Director::getInstance()->getVisibleSize().width/2,680)); bossEase = EaseBackInOut::create(bossAct); next->runAction(bossEase);}) 原文链接:https://www.f2er.com/cocos2dx/346170.html

猜你在找的Cocos2d-x相关文章