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

来源:互联网 发布:单片机计时器原理 编辑:程序博客网 时间:2024/06/05 22:45

转载请注明出处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);})


    


0 0