加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

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

发布时间:2020-12-14 19:26:35 所属栏目:百科 来源:网络整理
导读:转载请注明出处 http://blog.csdn.net/wjlpld/article/details/41147457,谢谢~~~~ ------------------------------- 以下是开发常用代码------------------------------- ------------------------------- 帧动画 ------------------------------- Animatio

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

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

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

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));




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

    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)-------------------------------

CallFunc::create(
                                                            [&](){
                                                                bossAct = MoveTo::create(tileShowTime,Point(Director::getInstance()->getVisibleSize().width/2,680));
                                                                bossEase = EaseBackInOut::create(bossAct);
                                                                next->runAction(bossEase);})

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读