首页 > 代码库 > Cocos2d-x 学习笔记2 - Actions(Basic) - 未完成
Cocos2d-x 学习笔记2 - Actions(Basic) - 未完成
//Example:
//reverse \ clone \ DelayTime \ EaseIn | EaseOut
void SpriteEase::onEnter(){ EaseSpriteDemo::onEnter(); auto move = MoveBy::create(3, Vec2(VisibleRect::right().x-130,0)); auto move_back = move->reverse();//action‘s reverse auto move_ease_in = EaseIn::create(move->clone(), 2.5f);//action‘s clone, easeIn auto move_ease_in_back = move_ease_in->reverse(); auto move_ease_out = EaseOut::create(move->clone(), 2.5f);//EaseOut auto move_ease_out_back = move_ease_out->reverse(); auto delay = DelayTime::create(0.25f);//delay can also be treated as a "action" to add to sequence
//The rest of the code is trivial auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr);//delay can also be cloned(basically it is a type of actions) auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), nullptr); auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), nullptr); auto a2 = _grossini->runAction(RepeatForever::create(seq1)); a2->setTag(1); auto a1 = _tamara->runAction(RepeatForever::create(seq2)); a1->setTag(1); auto a = _kathia->runAction(RepeatForever::create(seq3)); a->setTag(1); schedule(schedule_selector(SpriteEase::testStopAction), 6.25f);}
Cocos2d-x 学习笔记2 - Actions(Basic) - 未完成
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。