0

I want to create two separate scenes (menu and game) in my program, but not really sure how to go about it. Should I create screen outside of main loop or maybe within menu class?

Joe Doe
  • 193
  • 1
  • 5
  • 13
  • 1
    possible duplicate of [Pygame level/menu states](http://stackoverflow.com/questions/14700889/pygame-level-menu-states) – sloth Jul 01 '14 at 06:38

2 Answers2

0

I would do scenes as two separated classes with own mainloop.

I can use menu as main class and create screen before mainloop in menu and in mainloop I can game(screen).

I can create class app (with screen created before its mainloop) which calls menu(screen) or game(screen) (or other scenes). When player (during game) want to go to menu or options or help it returns to app and app calls menu(screen) or options(screen) or help(screen).

furas
  • 134,197
  • 12
  • 106
  • 148
-1

Use some sort of flag such as :

while True:
    if status = "menu": status = show_menu()
    elif status = "game": status = run_game()
    elif blah blah...

Have some code to return the appropriate status, like if game is selected from menu return "game".

user2963623
  • 2,267
  • 1
  • 14
  • 25