1
\$\begingroup\$

I'm working on a simple 2d puzzle with small textures (in count and quantity). Now after I finished the game logic I'm considering tow options to switch between levels:

  • Remove all objects manually and de-attach their spirits from the current scene .
  • Drop the whole scene and start the new level on a new scene.

Both options are not much different in code complexity in my case. so the question is what are the drawbacks of the second approach ? specifically is a scene a heavy object?

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Just drop the scene; it's easier, isn't it? It'll be quick and easy and if it has no drawbacks, just do it. If you see no issues, continue on. It seems like you're trying to optimize something that probably won't even be a problem. \$\endgroup\$ Commented Mar 28, 2013 at 13:37
  • \$\begingroup\$ If a scene is self-contained and it runs at an acceptable speed - there will be no consequences. As long as the scene is self-sufficent. If it is not, make sure you do any manual clean up needed. \$\endgroup\$ Commented Mar 28, 2013 at 13:45

1 Answer 1

3
\$\begingroup\$

The AndEngine documentation states that a Scene is nothing more than a mere container for a specific game state. Logically, if it makes sense for each "level" to be a state - (they are distinicntly different and require some complicated setup or it's just easier), just drop the scene. A scene is a self-contained state - just make sure to be careful that there is no shared state that may require clean up. (Globals are tricky for this... if you keep any global object references that are pertaining to that level, make sure you clean them up.)

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .