Switching classes

hi! Im new here and have a question

I have 2 classes (MainMenu and World)

The MainMenu class has a DirectButton which will load the World class. I destroy the DirectButton when the World class in loaded.

Everything seems fine, but now in the World class i have a self.accept(‘escape’, self.Menu), the function Menu will load the class MainMenu. I cleanup or destroy my actors and texts in the World class when the MainMenu class is loaded.

My question is:
Is there a clean way to switch between the MainMenu class and World class?


There sure is.
Check out panda’s Finite State Machines:
The explanation is about avatars, but it can be perfectly used in menu/game transitions. I use it in my own game for that goal as well.

oh Thank you much!