How do I use multiple runActions on sequences?

For clarification, I have the following code.

if (sprite != NULL)
{
	delay1 = CCDelayTime::create(1.5f);
	delay2 = CCDelayTime::create(3.0f);
	brickdelete = CallFunc::create([this]()
	{
		sprite->setOpacity(0);
		sprite->getPhysicsBody()->removeFromWorld();
	});
	brickcreate = CallFunc::create([this]()
	{
		sprite->setOpacity(255);
		sprite->setPhysicsBody(brickbody);
	});
	disintegratefunction = CallFunc::create([this]() {
		sprite->runAction(disintegrateAnim);
	});
	appearfunction = CallFunc::create([this]() {
		sprite->runAction(appearAnim);
	});
	runAction(Sequence::create(disintegratefunction, delay1, brickdelete, delay2, appearfunction, brickcreate, NULL));
}

I want to have multiple runAction instances happening at the same time. At the moment, if I start a runAction while another is in progress, I get multiple assertion fails and the remaining actions from the first sequence is added to the second runAction sequence (so the first body remains incomplete in some stage of the sequence).

I want them to be independent of each other. Is this possible? I also tried targetedaction but Iā€™m not sure the code was good since it had the same result.

You can use this

auto mario = Sprite::create("mario.png");

mario->setPosition(Vec2(origin.x,origin.y));

addChild(mario);

auto moveBack = MoveTo::create(2 ,Vec2(0,0));

auto moveTowards = MoveTo::create(2 ,Vec2(200,0));

auto timeDelay = DelayTime::create(0.5f);

auto seq = Sequence::create(moveTowards, timeDelay, moveBack, timeDelay, nullptr);
mario->runAction(RepeatForever::create(seq));

in this i am run two actions Sequenceualy repeated forever

1 Like