Source code for storyforge.menu
# storyforge/menu.py
import pygame
[docs]
class StoryMenu:
"""
Class responsible for displaying and managing the game menu.
Attributes:
- story (Story): The game's story object.
- ui (PygameUI): The game's user interface object.
Methods:
- show_menu(): Displays the game's main menu on the screen.
- continue_story(): Continues the story from a saved state or starts a new story, as chosen by the player.
- start_new_story(): Starts a new story, creating an empty state.
"""
def __init__(self, story, ui):
self.story = story
self.ui = ui
[docs]
def continue_story(self) -> None:
"""
Continue the story from a saved state or start a new story, as chosen by the player.
Return:
None
"""
if self.story.load_state():
self.story.validate_story()
else:
print("There is no saved state. Starting new story.")
self.start_new_story()
[docs]
def start_new_story(self) -> None:
"""
Starts a new story, creating an empty state.
Return:
None
"""
self.story.create_empty_state()