What is the best way to switch between scenes?

Cocos2d-JS v3
  • efares
    Likes 0

    Problem Description

    I have a **menuScene** and a **playScene** and I would like to know if I am switching between scenes the right way.

    From the menuScene I am using

    cc.director.runScene(new PlayScene()); // Play button

    And then from the playScene I also use 

    cc.director.runScene(new MenuScene()); // Exit button

    Should I be pushing/popping the menuScene? It's just a play button with a background image.
    If you can explain how to properly use the push/pop scene that would be very helpful!

  • Sonar Systems admin
    Likes 0

    In Cocos2d-x JavaScript runScene pops a scene if there is one to pop then pushes the one specified.

  • efares
    Likes 0

    OK so that means I don’t need to worry about pushing and popping scenes then right? All that is handled by Cocos2d-x even if that code says a new scene it doesn’t really make a new one?

  • Sonar Systems admin
    Likes 1

    Yh that is corrent.

Login to reply