Shows or hides buttons based on the current game state.
()
| 76 | buttons[name]['visible'] = False |
| 77 | |
| 78 | def manage_buttons(): |
| 79 | """Shows or hides buttons based on the current game state.""" |
| 80 | all_buttons = ["Play", "Pause", "Resume", "Restart"] |
| 81 | for btn_name in all_buttons: |
| 82 | hide_button(btn_name) |
| 83 | |
| 84 | btn_x = WIDTH / 2 - 100 |
| 85 | btn_y = HEIGHT / 2 - 45 |
| 86 | |
| 87 | if game_state == "start": |
| 88 | create_button("Play", 0, -100) |
| 89 | elif game_state == "playing": |
| 90 | create_button("Pause", btn_x, btn_y) |
| 91 | elif game_state == "paused": |
| 92 | create_button("Resume", btn_x, btn_y) |
| 93 | elif game_state == "game_over": |
| 94 | create_button("Restart", btn_x, btn_y) |
| 95 | |
| 96 | # --- GAME LOGIC & STATE TRANSITIONS --- |
| 97 | def start_game(): |
no test coverage detected