diff --git a/data/data.png b/data/data.png new file mode 100644 index 0000000000000000000000000000000000000000..af087751117087b6c797315bb33c3d10aa53c351 Binary files /dev/null and b/data/data.png differ diff --git a/main.py b/main.py index 40ccb03397f3343cb0cfdbbc588f4769ae784da1..508a8ecd8c035eabc8f66c64419f081b14d7ad4e 100644 --- a/main.py +++ b/main.py @@ -10,30 +10,39 @@ This is the main file of the game. It initializes PyGame and creates the screen The main event loop is also located here. """ -# Initialize PyGame -pygame.init() - -options = OptionsManager() # Load options -screen = pygame.display.set_mode(options.resolution) # Create the screen -clock = pygame.time.Clock() # Create clock - -sound_manager = SoundManager() # Create sound manager -sound_manager.set_options(options) # Set options -sound_manager.load_music() # Load music -sound_manager.play_music() # Play music - -scene_manager = SceneManager(screen, "main_menu") # Create scene manager and set default scene to main_menu - -# Main event loop -while True: - events = pygame.event.get() # Get all events - sound_manager.update(events) # Update sound manager - for event in events: - if event.type == pygame.QUIT: - pygame.quit() - sys.exit() - - scene_manager.active_scene.update(constants.DELTA_TIME, events) # Update the scene - - pygame.display.flip() # Update the display - clock.tick(constants.FRAMERATE) # Limit the framerate \ No newline at end of file +def main(): + """ + The main function of the game. It initializes PyGame and creates the screen and clock. It also creates the sound manager and scene manager. + The main event loop is also located here. + """ + + # Initialize PyGame + pygame.init() + + options = OptionsManager() # Load options + screen = pygame.display.set_mode(options.resolution) # Create the screen + clock = pygame.time.Clock() # Create clock + + sound_manager = SoundManager() # Create sound manager + sound_manager.set_options(options) # Set options + sound_manager.load_music() # Load music + sound_manager.play_music() # Play music + + scene_manager = SceneManager(screen, "main_menu") # Create scene manager and set default scene to main_menu + + # Main event loop + while True: + events = pygame.event.get() # Get all events + sound_manager.update(events) # Update sound manager + for event in events: + if event.type == pygame.QUIT: + pygame.quit() + sys.exit() + + scene_manager.active_scene.update(constants.DELTA_TIME, events) # Update the scene + + pygame.display.flip() # Update the display + clock.tick(constants.FRAMERATE) # Limit the framerate + +if __name__ == "__main__": + main() # Run the main function \ No newline at end of file