How to transfer SceneA->SceneB->SceneA ? Impossible?

How to transfer SceneA->SceneB->SceneA ? Impossible?
0.0 0


I cannot do this due to circular dependencies ?

How do you people do this ?

Can you please give basic examples as it seems impossible from my viewpoint

This solution isn’t working for me



Of course it is possible. Without insulting you how much c++ do you know? Lately you are asking questions that are generic to c++ and not Cocos2d-x. If you have circular dependencies fix them!

Post your files so we can help. By post I mean attached so I can drop them into a new project to work with.


Hi Slack. Sorry for been a nuisance…

Problem is simple help me with.

All I need is as standard HelloWorld1Scene to swap to a HelloWorld2Scene and then back again. Simple

Very short example. Just to show how it would be done would be great. i tied many things. Tried solutions shared in last post#

Driving me mad


Our programmers guide repo has this in many places.


YES . There we go . This is how it is done… Thanks very much Slack


Hi Slack

I went through this example. I looked at main scene class and checked chapter 2 and 3.

Main scene -> chapter 2 or 3

But no scene goes back to man scene

So there is no solution here

Still need example of SceneA->SceneB and then SceneB->SceneA



Just replace back replaceScene(scene) handles this. If it is crashing you probably have a scope issue. If you are really struggling I can make a simple example for you. cpp-tests also has examples of this I am sure.


Please slack make example.
Really mega simple example. On touch begin swaps to A, on touch begin swaps to B, on touch begin swaps to A… Etc…

Mega simple

Would love see it … I have looked through loads cpp test to try find it


SpeedCC can help you out.