def show_main_menu(paused = False): '''shows main menue. Allows options to be actuated''' screen = pygame.display.get_surface() splashImage = singleton_image_cache.get("splash.png") screen.blit(splashImage, (0,0)) # Update the display pygame.display.flip() # Freeze until a key is pressed proceed = False while not proceed: # If the user hit one of the inputs, proceed for event in pygame.event.get(): if event.type == KEYDOWN: key = event.unicode if key == 'i': draw_instructions(paused) elif key == 's': from level import goto_level goto_level(0) proceed = True elif key == 'q': pygame.quit() sys.exit() time.sleep(0.02) # avoid hogging the CPU
def load_game(): from level import goto_level name = get_input("Enter the name of the saved game.") if name.strip() == '': return path = get_save_path(name) try: with open(path, 'r') as f: saved_level = int(f.read()) goto_level(saved_level) except IOError: show_message("No save file with that name was found.")