Search code examples
cocos2d-x

Why update is not called after pushScene in cocos2d-x


There's a scene updating the game loop. And I made a shop scene.

Problem is previous scene update function is not called after shop scene is pushed.

I believe previous scene is not removed or deleted if new scene is added by pushScene method.

But why the update function is not called?

What's the best way to remain previous scene scheduler keep updating?

Thanks.


Solution

  • When you push a scene, that pushed scene is running and the previous scene is suspended. You can run whatever code you need in the update method of the pushed scene.

    Or don't push a new scene but instead put that scene's content on a layer and animate (fade, move) it into view as needed. That way the main scene retains control.