Interact two sprite actions?

Interact two sprite actions?


I want to interact two sprite actions. I guess sequence not supporting different sprites.

I need;
After completing sprite A action(s) I want to start B sprite action

how can I make it?


You could use Sequence
scene->runAction(Sequence::create(MoveTo(...), MoveTo(...), NULL));


Use Sequence and CallFunc


examples describes only one sprite sequence, I want sequence for different sprites. It seems only solution is calculating duration of sprite 1 actions and delay sprite 2

after sprite1 action > run sprite 2 action


Did you look at CallFunc ?


running sprite B action as CallFunc in sprite A sequence I will try this


Running Ease action in sequence within CallFunc crashes. without Ease it works


Show your code please

		auto toppercentanim = CallFunc::create([&](){
			auto scalepercent = ScaleTo::create(0.4f, 1.5f);
			auto percentease = EaseElasticOut::create( scalepercent );
			auto scalepercent2 = ScaleTo::create(0.2f, 1.0f);
			auto seq_   = Sequence::create(percentease, scalepercent2 );

auto seq   = Sequence::create(easeAction, scale2, moveby, spa, setPercent, toppercentanim, nullptr);

If i remove ease in CallFunc still not working, it works only if i remove sequence in CallFunc


You forgot to add nullptr at the end


Omg!, thanks It works

closed #12

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.