(please help!) Making a menu with several tabs

Hi,

This link shows you my level selection menu, with several scenes, you can see that it is laggy due to the fact it consists of several scenes:

I am trying to recreate it but am having lots of trouble, you see, when I click the portal button(grey contraption icon) with the destruction tab(white tower) open, it seamlessly goes to the scene of the portal tab in the video, this is alot harder and more complex to do without scenes, here is the button’s code so far without scenes:

    void LevelScene::PLevelB(cocos2d::Ref *pSender)
{

	CocosDenshion::SimpleAudioEngine::getInstance()->playEffect("Button clicked (7).mp3");
	CCLOG("To the portal menu");

	
	auto visibleSize = Director::getInstance()->getVisibleSize();
	Vec2 origin = Director::getInstance()->getVisibleOrigin();


	this->removeChild(DLevels);
	this->removeChild(DLevelB);
 


	PorLevels = Sprite::create("PORTAL TAB.png");

	PorLevels->setPosition(Point((visibleSize.width / 2) + origin.x, (visibleSize.height / 2) + origin.y));

	this->addChild(PorLevels);

    auto porSCALE = ScaleTo::create(NULL, 1);
	PorLevels->runAction(porSCALE);

	auto porMOVE = MoveBy::create(NULL, Point(NULL, -70));
	PorLevels->runAction(porMOVE);

	PPLevelB = Sprite::create("PORTAL TAB BUTTON.png");

	PPLevelB->setPosition(Point((visibleSize.width / 2) + origin.x, (visibleSize.height / 2) + origin.y));

	this->addChild(PPLevelB);

	auto PPMOVEB = MoveTo::create(NULL, Point(620, 634));
	PPLevelB->runAction(PPMOVEB);

	auto PPSCALEB = ScaleTo::create(NULL, 0.6);
	PPLevelB->runAction(PPSCALEB);


	
	auto Level_item_PD1 = MenuItemImage::create("DESTRUCTION TAB BUTTON.png", "DESTRUCTION TAB BUTTON.png", CC_CALLBACK_1(LevelScene::PDLevelB, this));

	Level_item_PD1->setPosition(Point((visibleSize.width / 2) + origin.x, (visibleSize.height / 2) + origin.y));

	auto PDExMoe = MoveBy::create(NULL, Point(-388, 160));
	Level_item_PD1->runAction(PDExMoe);

	auto PDExScae = ScaleTo::create(NULL, 0.3);
	Level_item_PD1->runAction(PDExScae);
	
	auto Level_item_PDR1 = MenuItemImage::create("DRAW TAB BUTTON.png", "DRAW TAB BUTTON.png", CC_CALLBACK_1(LevelScene::PDRlevelB, this));

	Level_item_PDR1->setPosition(Point((visibleSize.width / 2) + origin.x, (visibleSize.height / 2) + origin.y));

	auto pdrbMove = MoveBy::create(NULL, Point(130, 160));
	Level_item_PDR1->runAction(pdrbMove);

	auto pdrbScale = ScaleTo::create(NULL, 0.5);
	Level_item_PDR1->runAction(pdrbScale);

/*
	auto Level_item_PC1 = MenuItemImage::create("CRAZE TAB BUTTON.png", "CRAZE TAB BUTTON.png", CC_CALLBACK_1(LevelScene::PCRLevelB, this));

	Level_item_PC1->setPosition(Point((visibleSize.width / 2) + origin.x, (visibleSize.height / 2) + origin.y));

	auto CCPMove = MoveBy::create(NULL, Point(376, 152));
	Level_item_PC1->runAction(CCPMove);

	auto CCPScale = ScaleTo::create(NULL, 0.39);
	Level_item_PC1->runAction(CCPScale); */

	auto *PLmenu = Menu::create(/*Level_item_P1,*/ Level_item_PD1, Level_item_PDR1, /*Level_item_PC1*/ NULL);
	PLmenu->setPosition(Point(0, 0));
	this->addChild(PLmenu);

}
		void LevelScene::PDLevelB(cocos2d::Ref *pSender)
	  {
			this->removeChild(DLevels);
			this->removeChild(PPLevelB);



		auto visibleSize = Director::getInstance()->getVisibleSize();
		Vec2 origin = Director::getInstance()->getVisibleOrigin();

		CocosDenshion::SimpleAudioEngine::getInstance()->playEffect("Button clicked (7).mp3");
		CCLOG("To the destructive menu");


		this->removeChild(PorLevels);
		

		DLevels = Sprite::create("DESTRUCTION TAB.png");

		DLevels->setPosition(Point((visibleSize.width / 2) + origin.x, (visibleSize.height / 2) + origin.y));

		this->addChild(DLevels);

		auto DLSCALE = ScaleTo::create(NULL, 1);
		DLevels->runAction(DLSCALE);

		auto DLMOVE = MoveBy::create(NULL, Point(NULL, -70));
		DLevels->runAction(DLMOVE);



		this->removeChild(PPLevelB);
        };

		void LevelScene::PDRlevelB(cocos2d::Ref *pSender)
		{
			this->removeChild(DLevels);


			auto visibleSize = Director::getInstance()->getVisibleSize();
			Vec2 origin = Director::getInstance()->getVisibleOrigin();

			CocosDenshion::SimpleAudioEngine::getInstance()->playEffect("Button clicked (7).mp3");
			CCLOG("To the draw menu");

           this->removeChild(PorLevels);


			DRLevels = Sprite::create("DRAW TAB.png");

			DRLevels->setPosition(Point((visibleSize.width / 2) + origin.x, (visibleSize.height / 2) + origin.y));

			this->addChild(DRLevels);

			auto DRSCALE = ScaleTo::create(NULL, 1);
			DRLevels->runAction(DRSCALE);

			auto DRMOVE = MoveBy::create(NULL, Point(NULL, -70));
			DRLevels->runAction(DRMOVE);


		};

no doubt I am heading in the wrong direction. And I simply have no idea how to efficiently and effectively recreate my menu within one scene. Can you point me in the right direction?

You talking about lagging but I don’t see lagging, I see some blinking:

And reason is such animations with 0 delay:

To fix blinking either set some enough delay or just use setPosition and setScale

it did not change anything :sob:

A bit pedantic but you technically don’t have multiple scenes persay. You don’t have a new Scene object for each tab. Aren’t you using a layer or node object for each scene?

I prefer some delay as my approach.

exactly as it does in the video, i am trying to re-create it, but its going very not to plan.