首页 > 代码库 > 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) - 未完成