def main_menu(): global game_state img = libtcod.image_load('playground-title-small.png') while not libtcod.console_is_window_closed(): #show the background image, at twice the regular console resolution libtcod.image_blit_2x(img, 0, 0, 0) #show options and wait for the player's choice if game_state == 'won': img = libtcod.image_load('playground-win-small.png') choice = draw.menu('Congrats! Your score was ' + str(objects.score) + '.', ['Play a new game', 'Instructions','About','Quit'], 35) else: choice = draw.menu('', ['Play a new game', 'Instructions','About','Quit'], 24) if choice == 0: #new game new_game() play_game() elif choice == 1: #instructions blah = draw.instructions('',instructions,50) elif choice == 2: #about blah = draw.instructions('',credits,50) elif choice == 3: #quit break
def main_menu(): img = libtcod.image_load(b'img/backgrounds/menu_background.png') while not libtcod.console_is_window_closed(): # Show the background image at twice the regular console resolution libtcod.image_blit_2x(img, 0, 0, 0) # Show the game's title libtcod.console_set_default_foreground(0, libtcod.light_yellow) libtcod.console_set_alignment(0, libtcod.CENTER) libtcod.console_print(0, int(round(SCREEN_WIDTH / 2)), int(round(SCREEN_HEIGHT / 2 - 4)), 'THE LEGEND OF THARSA') libtcod.console_print(0, int(round(SCREEN_WIDTH / 2)), int(round(SCREEN_HEIGHT - 2)), 'By Athemis') # Show the options and wait for the player's choice choice = menu('', ['Play a new game', 'Continue last game', 'Quit'], 24) if choice == 0: # New game new_game() play_game() elif choice == 1: # Load last game try: load_game() except: msgbox('\n No saved game to load. \n', 24) continue play_game() elif choice == 2: # Quit break
def main_menu(): if (libtcod.random_get_int(0, 0, 1) == 0): img = libtcod.image_load('menu_background.png') else: img = libtcod.image_load('menu_background2.png') while not libtcod.console_is_window_closed(): #show the background image, at twice the regular console resolution libtcod.image_blit_2x(img, 0, 0, 0) #show the game's title, and some credits! libtcod.console_set_default_foreground(0, libtcod.light_yellow) libtcod.console_set_alignment(0, libtcod.CENTER) libtcod.console_print(0, SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2 - 4, 'Party Rogue WIP') libtcod.console_print(0, SCREEN_WIDTH / 2, SCREEN_HEIGHT - 2, 'By Dragynrain') libtcod.console_set_alignment(0, libtcod.LEFT) #show options and wait for the player's choice choice = menu('', ['Play a new game', 'Continue last game', 'Quit'], 24) if choice == 0: # new game new_game() play_game() if choice == 1: # load last game try: load_game() except: msgbox('\n No saved game to load.\n', 24) continue play_game() elif choice == 2: # quit break
def main_menu(self): """THE main menu, no other.""" LIMIT_FPS = 20 libtcod.sys_set_fps(LIMIT_FPS) img = libtcod.image_load('main/lazor.png') while not libtcod.console_is_window_closed(): #show the background image, at twice the regular console resolution libtcod.image_blit_2x(img, 0, 0, 0) #show the game's title, and credits libtcod.console_set_default_foreground(0, color_menu_text) libtcod.console_print_ex(0, SCREEN_WIDTH/2, 1, libtcod.BKGND_NONE, libtcod.CENTER, 'Laz0r Dodging Game') libtcod.console_print_ex(0, SCREEN_WIDTH/2, 2, libtcod.BKGND_NONE, libtcod.CENTER, 'by magikmw') #show options and wait for the player's choice choice = menu('Choose an option:\n', ['Real-Time', 'Turn-Based', 'Highscores', 'Help', 'Quit.'], 18, -10) if choice == 0: #new game self.new_game('RT') if choice == 1: self.new_game('TB') if choice == 2: #TODO the highscore function call here pass if choice == 3: #TODO help screen funcion call here pass if choice == 4: #quit break
def story_slide(): img = libtcod.image_load('menu_background2.png') if dungeon_level == 0: level_subtitle = 'LEVEL 0' elif dungeon_level == 1: level_subtitle = 'LEVEL 1' elif dungeon_level == 2: level_subtitle = 'BEFORE THE STARDUST FADES' elif dungeon_level == 3: level_subtitle = 'WISH UPON THE DIAMOND DUST' while not libtcod.console_is_window_closed(): #show the background image, at twice the regular console resolution libtcod.image_blit_2x(img, 0, 0, 0) #show the game's title, and some credits! libtcod.console_set_default_foreground(0, libtcod.light_yellow) libtcod.console_print_ex(0, SCREEN_WIDTH/2, SCREEN_HEIGHT/2-6, libtcod.BKGND_NONE, libtcod.CENTER, 'CHAPTER '+str(dungeon_level)) libtcod.console_print_ex(0, SCREEN_WIDTH/2, SCREEN_HEIGHT/2-4, libtcod.BKGND_NONE, libtcod.CENTER, level_subtitle) libtcod.console_print_ex(0, SCREEN_WIDTH/2, SCREEN_HEIGHT-2-2, libtcod.BKGND_NONE, libtcod.CENTER, '- w5748 -') #show options and wait for the player's choice choice = menu('', ['PROCEED'], 11) if choice == 0: #PROCEED PATH, THINK ABOUT A save_game() ROUTE break elif choice == 1: break
def main_menu(): img = libtcod.image_load('menu_background.png') while not libtcod.console_is_window_closed(): #show the background image, at twice the regular console resolution libtcod.image_blit_2x(img, 0, 0, 0) #show the game's title, and some credits! libtcod.console_set_default_foreground(0, libtcod.light_red) libtcod.console_print_ex(0, SCREEN_WIDTH/2, SCREEN_HEIGHT/2-8, libtcod.BKGND_NONE, libtcod.CENTER, 'R- U- N-') libtcod.console_print_ex(0, SCREEN_WIDTH/2, SCREEN_HEIGHT/2-6, libtcod.BKGND_NONE, libtcod.CENTER, 'Something cool') libtcod.console_print_ex(0, SCREEN_WIDTH/2, SCREEN_HEIGHT-2-2, libtcod.BKGND_NONE, libtcod.CENTER, '- w5748 -') #show options and wait for the player's choice choice = menu('', ['New Game', 'Load File', 'Quit'], 24) if choice == 0: #new game new_game() play_game() if choice == 1: #load last game try: load_game() except: msgbox('\n No saved game to load.\n', 24) continue play_game() elif choice == 2: #quit break
def main_menu(): img = libtcod.image_load('menu_background1.png') while not libtcod.console_is_window_closed(): #show the background image, at twice the regular console resolution libtcod.image_blit_2x(img, 0, 0, 0) #show the game's title, and some credits! libtcod.console_set_default_foreground(0, libtcod.light_yellow) libtcod.console_print_ex(0, SCREEN_WIDTH/2, SCREEN_HEIGHT/2-4, libtcod.BKGND_NONE, libtcod.CENTER, 'The Universal Reference Frame') libtcod.console_print_ex(0, SCREEN_WIDTH/2, SCREEN_HEIGHT-2, libtcod.BKGND_NONE, libtcod.CENTER, 'By Pat East and Scotty Jones') #show options and wait for the player's choice #Have the Player Choose his race choice = menu('', ['Play a new game', 'Continue last game', 'Quit'], 24) if key.vk == libtcod.KEY_ENTER and key.lalt: #Alt+Enter: toggle fullscreen libtcod.console_set_fullscreen(not libtcod.console_is_fullscreen()) if choice == 0: #new game new_game() play_game() elif choice == 1: #load last game try: load_game() except: msgbox('\n No saved game to load.\n', 24) continue play_game() elif choice == 2: #quit break
def main_menu(): img = libtcod.image_load('star.png') while not libtcod.console_is_window_closed(): # background image libtcod.image_blit_2x(img, 0, 0, 0) # title and credits libtcod.console_set_default_foreground(0, libtcod.red) libtcod.console_print_ex(0, SCREEN_WIDTH/2, SCREEN_HEIGHT/2-4, libtcod.BKGND_NONE, libtcod.CENTER, 'TEST GAME') libtcod.console_print_ex(0, SCREEN_WIDTH/2, SCREEN_HEIGHT/2-3, libtcod.BKGND_NONE, libtcod.CENTER, 'by MoyTW') # menu + choice choice = menu('', ['New game', 'Continue game', 'Quit'], 24) if choice == 0: new_game() play_game() elif choice == 1: try: load_game() except: msgbox('\n Error loading game.\n', 24) continue play_game() elif choice == 2: break
def showDebugScreen(self): # store the current view behind_window = libtcod.console_new(SCREEN_WIDTH, SCREEN_HEIGHT) libtcod.console_blit(0, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, behind_window, 0, 0, 1.0, 1.0) # show the background image, at twice the regular console resolution img = libtcod.image_load("./media/menu_debug.png") libtcod.image_blit_2x(img, 0, 0, 0) while not libtcod.console_is_window_closed(): # show options and wait for the player's choice choice = self.showMenu( "Select debug option:", ["Run some test code!", "Show me some game stuff!", "Back"], # Choice 0 # Choice 1 # Choice 2 36, ) # interpret choice if choice is None: continue if choice == 0: print "Running some test code!" self.runTestCode() self.showMessage("Test code complete!", "There might be some output in the console...", 36) continue elif choice == 1: print "Showing some game stuff!" self.newGame() self.showGameScreen() elif choice == 2: # quit print "Back" break # Clean up (restore whatever was behind this window) libtcod.console_blit(behind_window, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0, 0, 1.0, 1.0) libtcod.console_flush()
def main_menu(): img = libtcod.image_load('rltutBackdrop.png') while not libtcod.console_is_window_closed(): #libtcod.image_blit(img, 0, 0, 0) #show the background image at twice the regular console resolution libtcod.image_blit_2x(img, 0, 0, 0) #show game's title and some credits libtcod.console_set_default_foreground(0, libtcod.light_yellow) libtcod.console_print_ex(0, SCREEN_WIDTH/2, SCREEN_HEIGHT/2-4, libtcod.BKGND_NONE, libtcod.CENTER, MAIN_TITLE) libtcod.console_print_ex(0, SCREEN_WIDTH/2, SCREEN_HEIGHT-2, libtcod.BKGND_NONE, libtcod.CENTER, 'by Austin McGee') #print controls libtcod.console_print_ex(0, 1, 1, libtcod.BKGND_NONE, libtcod.LEFT, CONTROLS_TEXT) #show options and wait for the player's choice choice = menu('', ['Play a new game', 'Continue last game', 'Quit'], 24) if choice == 0: #new game new_game() play_game() if choice == 1: #load last game try: load_game() except: msgbox('\n No saved game to load.\n', 24) continue play_game() elif choice == 2: #quit break
def main_menu(): img = libtcod.image_load('BG_IMG.png') while not libtcod.console_is_window_closed(): #show the background image, at twice the regular console resolution libtcod.image_blit_2x(img, 0, 0, 0) #show the game's title, and some credits! libtcod.console_set_default_foreground(0, libtcod.Color(79, 227, 0)) libtcod.console_print_ex(0, SCREEN_WIDTH/2, SCREEN_HEIGHT/2-4, libtcod.BKGND_NONE, libtcod.CENTER, 'mi8-reEVA') libtcod.console_print_ex(0, SCREEN_WIDTH/2, SCREEN_HEIGHT/2+4, libtcod.BKGND_NONE, libtcod.CENTER, 'by defined moe.') choice = menu('', ['start game', 'continue', 'quit'], 24) if choice == 0: new_game() play_game() if choice == 1: #load last game try: load_game() except: msgbox('\n No saved game to load.\n', 24) continue play_game() elif choice == 2: #quit break
def main_menu(): """ Game main menu """ img = libtcod.image_load('menu_background.png') title = 'Rumble in the Underdeep' author = 'By @cr8ivecodesmith' while not libtcod.console_is_window_closed(): # blit the bg image at twice the regular console resolution libtcod.image_blit_2x(img, 0, 0, 0) libtcod.console_set_default_foreground(0, libtcod.gold) libtcod.console_print_ex(0, SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2 - 4, libtcod.BKGND_NONE, libtcod.CENTER, title) libtcod.console_print_ex(0, SCREEN_WIDTH / 2, SCREEN_HEIGHT - 2, libtcod.BKGND_NONE, libtcod.CENTER, author) # show the options and wait for the player's input choice = menu('', ['New game', 'Continue', 'Quit'], 24) if choice == 0: # New game new_game() play_game() elif choice == 1: try: load_game() play_game() except Exception as e: print(e) msgbox('\nNo saved game to load.\n', 24) continue elif choice == 2: # Quit break
def mainMenu(): img = libtcod.image_load("menu_background1.png") while not libtcod.console_is_window_closed(): #Show the background image, at twice the regular console resolution. libtcod.image_blit_2x(img, 0, 0, 0) #Show the game's title. libtcod.console_set_default_foreground(0, libtcod.light_yellow) libtcod.console_print_ex(0, SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2 - 6, libtcod.BKGND_NONE, libtcod.CENTER, "FORCASTIA TALES: THE MARKED") libtcod.console_print_ex(0, SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2 - 4, libtcod.BKGND_NONE, libtcod.CENTER, "2014 Studio Draconis") #Show options and wait for the player's choice. choice = menu('', ["Start a New Adventure", "Continue a Previous Adventure", "Quit"], 40) if choice == 0: #NEW GAME startNewGame() playGame() if choice == 1: #LOAD GAME try: loadGame() except: announce("\n No saved game to load. \n", 24) continue playGame() elif choice == 2: #QUIT break
def main_menu(): # will work with no image but the background on the menu will be plain black. img = libtcod.image_load('images\menu_background.png') while not libtcod.console_is_window_closed(): clear_all_consoles() libtcod.image_blit_2x(img, 0, 0, 0) choice = menu('', ['Play a new game', 'Continue last game', 'Quit'], width=24, x=4, y=2) if key.vk == libtcod.KEY_ENTER and (key.lalt or key.ralt): # Alt + Enter: toggle full screen libtcod.console_set_fullscreen(not libtcod.console_is_fullscreen()) if choice == 0: new_game() play_game() elif choice == 1: try: load_game() except: menu('\n No saved game to load. \n', [], width=24, x=((STAT_PANEL_WIDTH + SCREEN_WIDTH - 24) / 2), y=2) continue play_game() elif choice == 2: break
def main_menu(): """Displays splash screen and initial options such as new game, continue, save/load.""" global end_credits img = libtcod.image_load('2001_station_and_shuttle.png') end_credits = False while not libtcod.console_is_window_closed(): #show the background image at 2x the normal resolution using special font characters to do sub-cell shading: libtcod.image_blit_2x(img, 0, 0, 0) #show the game's title and opening credits libtcod.console_set_default_foreground(0, libtcod.light_yellow) libtcod.console_print_ex(0, SCREEN_WIDTH/2, SCREEN_HEIGHT/2-4, libtcod.BKGND_NONE, libtcod.CENTER, 'MANY MARTIANS!') libtcod.console_print_ex(0, SCREEN_WIDTH/2, SCREEN_HEIGHT-2, libtcod.BKGND_NONE, libtcod.CENTER, 'By K\'NEK-TEK') #show options and wait for the player's choice choice = menu('', ['New Game', 'Continue', 'Quit'], 24) if choice == 0: #new game list_of_maps, map_number = new_game() play_game(list_of_maps, map_number) elif choice == 1: #load game try: load_game() except: msgbox('\n No saved game to load.\n', 24) continue play_game(list_of_maps, map_number) elif choice == 2: #quit break
def main_menu(): img = libtcod.image_load(b'menu_background3.png') while not libtcod.console_is_window_closed(): # Show the background image at twice the regular resolution. libtcod.image_blit_2x(img, 0, 0, 0) # Show the game's title and credits. libtcod.console_set_default_foreground(0, libtcod.light_yellow) libtcod.console_print_ex(0, SCREEN_WIDTH//2, SCREEN_HEIGHT//2-4, libtcod.BKGND_NONE, libtcod.CENTER, 'TOMBS OF NEW BEGINNINGS') libtcod.console_print_ex(0, SCREEN_WIDTH//2, SCREEN_HEIGHT-2, libtcod.BKGND_NONE, libtcod.CENTER, 'By Parker Harris Emerson') # Show options and wait for the player's choice. choice = menu('', ['Play a new game', 'Continue last game', 'Quit'], 24) if choice == 0: # New Game global light light = Light() new_game() play_game() elif choice == 1: #load last game try: load_game() except: msgbox('\n No saved game to load.\n', 24) continue play_game() elif choice == 2: # Quit break
def main_menu(): img = libtcod.image_load('menu_background.png') while not libtcod.console_is_window_closed(): #show the background image, at twice the regular console resolution libtcod.image_blit_2x(img, 0, 0, 0) #show the game's title, and some credits! libtcod.console_set_foreground_color(0, libtcod.light_yellow) libtcod.console_print_center(0, SCREEN_WIDTH/2, SCREEN_HEIGHT/2-4, libtcod.BKGND_NONE, 'Rogue-LIKE!') libtcod.console_print_center(0, SCREEN_WIDTH/2, SCREEN_HEIGHT-2, libtcod.BKGND_NONE, 'By RobBbot') #show options and wait for the player's choice choice = menu('', ['Play a new game', 'Continue last game', 'Controls', 'Quit'], 24) if choice == 0: #new game new_game() play_game() if choice == 1: #load last game try: load_game() except: msgbox('\n No saved game to load.\n', 24) continue play_game() elif choice == 2: msgbox('\n "g" will pickup items\n\n "i" will bring up your inventory \n\n "d" will drop an item on the ground\n\n Arrow keys move the @ around\n\n Casting Spells requires you to click on the\n mob you want to target after selecting \n the scroll from your inventory') elif choice == 3: #quit break
def main_menu(self): #load the background. img = libtcod.image_load('menu_background.png') #while the window is open, display the menu. while not libtcod.console_is_window_closed(): #show the background image, at twice the regular console resolution libtcod.image_blit_2x(img, 0, 0, 0) #show the game's title and some credits! libtcod.console_set_default_foreground(0, libtcod.light_yellow) libtcod.console_print_ex(0, Screen.SCREEN_WIDTH / 2, Screen.SCREEN_HEIGHT / 2 - 4, libtcod.BKGND_NONE, libtcod.CENTER, 'TOMBS OF THE ANCIENT KINGS') libtcod.console_print_ex(0, Screen.SCREEN_WIDTH / 2, Screen.SCREEN_HEIGHT - 2, libtcod.BKGND_NONE, libtcod.CENTER, 'By Steven') #show options and wait for the player's choice choice = self.screen.menu('', ['Play a new game', 'Continue last game', 'Quit'], 24) if choice == 0: #new game self.new_game() self.play_game() elif choice == 1: #load game try: self.load_game() except: #there's an issue (of some sort) loading the game, so just default to no save game error. self.screen.msgbox('\n No saved game to load!\n', 24) continue #play the loaded game. self.play_game() elif choice == 2: #quit break
def main_menu(): img = libtcod.image_load('menu_background.png') while not libtcod.console_is_window_closed(): #show the background image, at twice the regular console resolution libtcod.image_blit_2x(img, 0, 0, 0) #show the game's title, and some credits! libtcod.console_set_default_foreground(0, libtcod.light_yellow) libtcod.console_print_ex(0, SCREEN_WIDTH/2, SCREEN_HEIGHT/2-4, libtcod.BKGND_NONE, libtcod.CENTER, 'TOMBS OF THE ANCIENT KINGS') libtcod.console_print_ex(0, SCREEN_WIDTH/2, SCREEN_HEIGHT-2, libtcod.BKGND_NONE, libtcod.CENTER, 'By Jotaf') #show options and wait for the player's choice choice = menu('', ['Play a new game', 'Continue last game', 'Quit'], 24) if choice == 0: #new game new_game() play_game() if choice == 1: #load last game try: load_game() except: msgbox('\n No saved game to load.\n', 24) continue play_game() elif choice == 2: #quit break
def main_menu(): img = libtcod.image_load('menu_background.png') while not libtcod.console_is_window_closed(): #show the menu image in a terrible way libtcod.image_blit_2x(img, 0, 0, 0) #fancy main menu title and crediting libtcod.console_set_default_foreground(0, libtcod.white) libtcod.console_set_default_background(0, libtcod.black) libtcod.console_print_ex(0, SCREEN_WIDTH/2, SCREEN_HEIGHT/2-4, libtcod.BKGND_ALPHA(0.7), libtcod.CENTER, 'JOTAF\'S COMPLETE ROGUELIKE TUTORIAL,') libtcod.console_print_ex(0, SCREEN_WIDTH/2, SCREEN_HEIGHT/2-3, libtcod.BKGND_ALPHA(0.7), libtcod.CENTER, 'USING PYTHON+LIBTCOD') #libtcod.console_print_ex(0, SCREEN_WIDTH/2, SCREEN_HEIGHT-2, libtcod.BKGND_ALPHA(0.7), libtcod.CENTER, 'Implemented By') #show main menu optionss and request selection choice = menu('', ['Play a new game', 'Continue last game', 'Quit'], 24) #fullscreen toggle needs to work in main menu too #if key.vk == libtcod.KEY_ENTER and key.lalt: # libtcod.console_set_fullscreen(not libtcod.console_is_fullscreen()) if choice == 0: #new game new_game() play_game() elif choice == 1: #load game try: load_game() except: msgbox('\n No saved game to load.\n', 24) continue play_game() elif choice == 2: #quit break
def main_menu(): #Set up the main menu, which is presented to the player when they first load the game img = libtcod.image_load('images/menu_background1.png') while not libtcod.console_is_window_closed(): #Show the image at twice its usual resolution of the console libtcod.image_blit_2x(img, 0, SCREEN_WIDTH / 6, SCREEN_HEIGHT / 6) #Show the games title, and some credits libtcod.console_set_default_foreground(0, libtcod.light_yellow) libtcod.console_print_ex(0, SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2 - 4, libtcod.BKGND_NONE, libtcod.CENTER, 'DUNGEONCRAWLER') libtcod.console_print_ex(0, SCREEN_WIDTH / 2, SCREEN_HEIGHT - 2, libtcod.BKGND_NONE, libtcod.CENTER, 'By Jeremy Cerise') #Show menu options and wait for the players choice choice = menu('', ['Play a new game', 'Continue last game', 'Quit'], 24) if choice == 0: #Start a new game #Clear the base conosle, so the menu image and options don't show up under the rest of the UI libtcod.console_set_default_background(0, libtcod.brass) libtcod.console_clear(0) new_game() play_game() elif choice == 1: try: libtcod.console_set_default_background(0, libtcod.brass) libtcod.console_clear(0) load_game() except: msgbox('\n No saved game to load!\n', 24) elif choice == 2: #Exit the program break;
def main_menu(): img = libtcod.image_load('menu_background1.png') while not libtcod.console_is_window_closed(): #show the background image, at twice the regular console resolution libtcod.image_blit_2x(img, 0, 0, 0) #show the game's title, and some credits! libtcod.console_set_foreground_color(0, libtcod.black) libtcod.console_print_center(0, SCREEN_WIDTH/2, SCREEN_HEIGHT/2-4, libtcod.BKGND_NONE, 'P U R G A T O R I O') libtcod.console_set_foreground_color(0, libtcod.white) libtcod.console_print_center(0, SCREEN_WIDTH/2, SCREEN_HEIGHT-2, libtcod.BKGND_NONE, 'By CitizenArcane') #show options and wait for the player's choice choice = menu(' ', ['Play a new game', 'Continue last game', 'Quit'], 24) if choice == 0: #new game new_game() play_game() elif choice == 1: #load last game try: load_game() except: msgbox('\n No saved game to load. \n', 24) continue play_game() elif choice == 2: #quit break
def main_menu(): img = libtcod.image_load('menu_background1.png') while not libtcod.console_is_window_closed(): #show the background image, at twice the regular console resolution libtcod.image_blit_2x(img, 0, 0, 0) #show the game's title, and some credits! libtcod.console_set_default_foreground(0, libtcod.black) libtcod.console_print(0, config.SCREEN_WIDTH/2, config.SCREEN_HEIGHT/2-4, 'P U R G E') libtcod.console_set_default_foreground(0, libtcod.white) libtcod.console_print(0, config.SCREEN_WIDTH/2, config.SCREEN_HEIGHT-2, 'By Nathaniel Berens') #show options and wait for the player's choice choice = gfx.menu(' ', ['Play a new game', 'Continue last game', 'Quit'], 24) if choice == 0: #new game new_game() play_game() elif choice == 1: #load last game try: load_game() except: gfx.msgbox('\n No saved game to load. \n', 24) continue play_game() elif choice == 2: #quit break
def main_menu(): img = libtcod.image_load('terminal12x12_gs_ro.png') while not libtcod.console_is_window_closed(): libtcod.image_blit_2x(img, 0, 0, 0) libtcod.console_set_default_foreground(0, libtcod.light_yellow) libtcod.console_print_ex(0, SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2 - 4, libtcod.BKGND_NONE, libtcod.CENTER, 'Tomb of the Ancient Kings') libtcod.console_print_ex(0, SCREEN_WIDTH / 2, SCREEN_HEIGHT - 2, libtcod.BKGND_NONE, libtcod.CENTER, 'Author') choice = menu('', ['Play a new game', 'Continue last game', 'Quit'], 24) if choice == 0: new_game() play_game() if choice == 1: try: load_game() except: msgbox('\n No saved game to load. \n', 24) continue play_game() elif choice == 2: break
def main_menu(): img = libtcod.image_load('menu_background.png') while not libtcod.console_is_window_closed(): libtcod.image_blit_2x(img, 0, 0, 0) libtcod.console_set_default_foreground(0, libtcod.light_yellow) libtcod.console_print_ex(0, SCREEN_WIDTH/2, SCREEN_HEIGHT/2-4, libtcod.BKGND_NONE, libtcod.CENTER, 'TITLE FORTHCOMING (BETA)') libtcod.console_print_ex(0, SCREEN_WIDTH/2, SCREEN_HEIGHT/2-3, libtcod.BKGND_NONE, libtcod.CENTER, 'Results may vary') choice = menu('', ['Play a new game', 'Continue last game', 'Controls', 'Quit'], 24) if choice == 0: new_game() play_game() if choice == 1: try: load_game() except: msgbox('\n No saved game to load.\n', 24) continue play_game() if choice == 2: msgbox('\n Arrow keys or number pad: move/attack \n 1-9: cast spells \n i: inventory \n g: pick up item \n d: drop items \n c: stats \n Enter: climb ladder \n Escape: quit to main menu', 50) continue elif choice == 3: break
def mainMenu(): image = libtcod.image_load("menu_background1.png") while not libtcod.console_is_window_closed(): #Shows the background image libtcod.image_blit_2x(image, 0, 0, 0) #shows the game title and author libtcod.console_set_foreground_color(0, libtcod.light_orange) libtcod.console_print_center(0, SCREEN_WIDTH/2, SCREEN_HEIGHT/2-5, libtcod.BKGND_NONE, "Jules Quest") libtcod.console_print_center(0, SCREEN_WIDTH/2, SCREEN_HEIGHT/2-3, libtcod.BKGND_NONE, "By Julian Jocque") menuOptions = ["New Game", "Continue", "Quit"] #shows options and waits for a choice choice = menu("", menuOptions, MAIN_MENU_WIDTH) if choice == 0: #new game newGame() playGame() elif choice == 1: #continue try: loadGame() playGame() except: msgBox("\n No save file found.\n", MAIN_MENU_WIDTH) continue #elif choice == 2: #show instructions # menu("\nArrow Keys to move and attack monsters.\nG to pickup an item you are standing on.\nI to open Inventory.\n" +\ # "D to open Drop menu.\nP to pause and unpause.\nC to open Character information screen.\n> to go down stairs.\n" +\ # "Mouse over a tile to see what is on it, either monsters or items.\n", [], SCREEN_WIDTH/2) elif choice == 2: #quit break
def main_menu(): img = libtcod.image_load('title.png') while not libtcod.console_is_window_closed(): # show the background image, at twice the regular console resolution libtcod.image_blit_2x(img, 0, 0, 0) # show the game's title, and some credits! libtcod.console_set_default_foreground(0, libtcod.black) libtcod.console_print_ex(0, SCREEN_WIDTH / 2, int(SCREEN_HEIGHT * .75), libtcod.BKGND_NONE, libtcod.CENTER, 'WizRL') libtcod.console_print_ex(0, SCREEN_WIDTH / 2, int(SCREEN_HEIGHT * .75) + 2, libtcod.BKGND_NONE, libtcod.CENTER, 'By Dragyn') # show options and wait for the player's choice choice = menu('', ['Play a new game', 'Continue last game', 'Quit'], 24) if choice == 0: # new game libtcod.console_clear(0) new_game() play_game() if choice == 1: # load last game try: load_game() except: msgbox('\n No saved game to load.\n', 24) continue play_game() elif choice == 2: # quit break
def main_menu(new_game, play_game, load_game): """ Prompt the player to start a new game, continue playing the last game, or exit. """ img = libtcod.image_load('menu_background.png') while not libtcod.console_is_window_closed(): # Show the background image, at twice the regular console resolution. libtcod.image_blit_2x(img, 0, 0, 0) libtcod.console_set_default_foreground(0, libtcod.light_yellow) libtcod.console_print_ex( 0, config.SCREEN_WIDTH/2, config.SCREEN_HEIGHT/2-4, libtcod.BKGND_NONE, libtcod.CENTER, 'TOMBS OF THE ANCIENT KINGS') libtcod.console_print_ex( 0, config.SCREEN_WIDTH/2, config.SCREEN_HEIGHT-2, libtcod.BKGND_NONE, libtcod.CENTER, 'By Jotaf') (char, choice) = menu('', ['Play a new game', 'Continue last game', 'Quit'], 24) if choice == 0: play_game(new_game()) if choice == 1: try: player = load_game() except: msgbox('\n No saved game to load.\n', 24) continue play_game(player) elif choice == 2: break
def main_menu(): img = libtcod.image_load('menu.png') while not libtcod.console_is_window_closed(): libtcod.image_blit_2x(img, 0, 0, 0) libtcod.console_set_default_foreground(0, libtcod.yellow) libtcod.console_print_ex(0, SCREEN_WIDTH/2, SCREEN_HEIGHT/2-4, libtcod.BKGND_NONE, libtcod.CENTER, 'The Halls of the Ancients') libtcod.console_print_ex(0, SCREEN_WIDTH/2, SCREEN_HEIGHT-2, libtcod.BKGND_NONE, libtcod.CENTER, 'By Forty-Bot') choice = menu('', ['New game', 'Continue', 'Quit'], 24) if choice == 0: new_game() play_game() elif choice == 1: try: load_game() except: msg_box('\nError loading save\n', 24) continue play_game() elif choice == 2: break
def main_menu(con, background_image, screen_width, screen_height): libtcod.image_blit_2x(background_image, 0, 0, 0) libtcod.console_set_default_foreground(0, libtcod.light_yellow) libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height / 2) - 4, libtcod.BKGND_NONE, libtcod.CENTER, 'THE NAME OF THE GAME OR SOMETHING') libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height - 2), libtcod.BKGND_NONE, libtcod.CENTER, 'By Brendin Stone') menu(con, '', ['Play a new game', 'Continue last game', 'Quit'], 24, screen_width, screen_height)
def main_menu(con, background_image, screen_width, screen_height): libtcod.image_blit_2x(background_image, 0, 0, 0) libtcod.console_set_default_foreground(0, libtcod.light_yellow) libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height / 2) - 4, libtcod.BKGND_NONE, libtcod.CENTER, 'agagagag kill everything agagagag') libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height - 2), libtcod.BKGND_NONE, libtcod.CENTER, 'By Big Bingus') menu(con, '', ['Play a new game', 'Continue last game', 'Quit'], 24, screen_width, screen_height)
def main_menu(con, background_image, screen_width, screen_height): libtcod.image_blit_2x(background_image, 0, 0, 0) libtcod.console_set_default_foreground(0, libtcod.light_yellow) libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height / 2) - 4, libtcod.BKGND_NONE, libtcod.CENTER, 'Dawn of Man') libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height - 2), libtcod.BKGND_NONE, libtcod.CENTER, 'By Matthew Staley') menu(con, '', ['Play a new game', 'Continue last game', 'Quit'], 24, screen_width, screen_height)
def main_menu(con, background_image, screen_width, screen_height): libtcod.image_blit_2x(background_image, 0, 0, 0) libtcod.console_set_default_foreground(0, libtcod.light_yellow) libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height / 2) - 4, libtcod.BKGND_NONE, libtcod.CENTER, 'TOMBS OF THE ANCIENT KINGS') libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height - 2), libtcod.BKGND_NONE, libtcod.CENTER, 'By (Your name here)') menu(con, '', ['Play a new game', 'Continue last game', 'Quit'], 24, screen_width, screen_height)
def print_char_big(self, icon_position, destination, console=0): source_pixel_x = (icon_position % ROW_LENGTH) * settings.TILE_WIDTH source_pixel_y = (icon_position / ROW_LENGTH) * settings.TILE_WIDTH dx, dy = destination if not self.font_image: self.font_image = libtcod.image_load(FONT_FILE_PATH) libtcod.image_set_key_color(self.font_image, libtcod.Color(0, 0, 0)) libtcod.image_blit_2x(self.font_image, console, dx, dy, source_pixel_x, source_pixel_y, settings.TILE_WIDTH, settings.TILE_WIDTH)
def main_menu(con, key, mouse): consts = Constants.consts path = consts['MENU_BACKGROUND'] img = libtcod.image_load(path) while not libtcod.console_is_window_closed(): libtcod.image_blit_2x(img, 0, 0, 0) choice = Menu.basic_menu(con, '', ['New game', 'Quit'], 24, key) if choice == 0: return True elif choice == 1: return False
def main_menu(con, background_image, screen_width, screen_height): lbtc.image_blit_2x(background_image, 0, 0, 0) lbtc.console_set_default_foreground(0, lbtc.light_yellow) lbtc.console_print_ex(0, int(screen_width / 2), int(screen_height / 2) - 4, lbtc.BKGND_NONE, lbtc.CENTER, 'COOL NAME HERE') lbtc.console_print_ex(0, int(screen_width / 2), int(screen_height - 2), lbtc.BKGND_NONE, lbtc.CENTER, 'By Bowser Master') menu(con, '', ['Play a new game', 'Continue last game', 'Quit'], 24, screen_width, screen_height)
def main_menu(con, background_image, screen_width, screen_height): libtcod.image_blit_2x(background_image, 0, 0, 0) libtcod.console_set_default_foreground(0, libtcod.light_yellow) libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height / 2) - 4, libtcod.BKGND_NONE, libtcod.CENTER, 'ROGUE ZERO PROJECT') libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height - 2), libtcod.BKGND_NONE, libtcod.CENTER, 'femto') menu(con, '', ['New Game', 'Continue', 'Quit'], 24, screen_width, screen_height)
def main_menu(con, background_image, screen_width, screen_height): libtcod.image_blit_2x(background_image, 0, 0, 0) libtcod.console_set_default_foreground(0, libtcod.light_yellow) libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height / 2) - 4, libtcod.BKGND_NONE, libtcod.CENTER, 'THE LIKIEST OF ROGUELIKES') libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height - 2), libtcod.BKGND_NONE, libtcod.CENTER, 'By Daealis') menu(con, '', ['Play a new game', 'Continue last game', 'Quit'], 24, screen_width, screen_height)
def main_menu(con, background_image, screen_width, screen_height): libtcod.image_blit_2x(background_image, 0, 0, 0) libtcod.console_set_default_foreground(0, libtcod.light_yellow) libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height / 2) - 4, libtcod.BKGND_NONE, libtcod.CENTER, 'EXPLORE THE DUNGEON') libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height - 2), libtcod.BKGND_NONE, libtcod.CENTER, 'By VortexHard') menu(con, '', ['Play a new game', 'Continue last game', 'Quit'], 24, screen_width, screen_height)
def main_menu(con, background_image, screen_width, screen_height): libtcod.image_blit_2x(background_image, 0, 0, 0) libtcod.console_set_default_foreground(0, libtcod.light_yellow) libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height / 2) - 4, libtcod.BKGND_NONE, libtcod.CENTER, 'Not Quite Paradise') libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height - 2), libtcod.BKGND_NONE, libtcod.CENTER, 'As told by the Dread Pirate Snayff') menu(con, '', ['Play a new game', 'Continue last game', 'Quit'], 24, screen_width, screen_height)
def main_menu(con, background_image, screen_width, screen_height): libtcod.image_blit_2x(background_image, 0, 0, 0) libtcod.console_set_default_foreground(0, libtcod.dark_red) libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height / 2) - 4, libtcod.BKGND_NONE, libtcod.CENTER, 'DARK SPIRAL') libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height - 2), libtcod.BKGND_NONE, libtcod.CENTER, 'By KirkusMax') menu(con, '', ['Play a new game', 'Continue last game', 'Quit'], 24, screen_width, screen_height)
def main_menu(con, background_image, screen_width, screen_height): libtcod.image_blit_2x(background_image, 0, 0, 0) libtcod.console_set_default_foreground(0, libtcod.light_yellow) libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height / 2) - 4, libtcod.BKGND_NONE, libtcod.CENTER, 'FUZZY WUZZY HUNTERS') libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height - 2), libtcod.BKGND_NONE, libtcod.CENTER, 'By Akhier Dragonheart') menu(con, '', ['Play a new game', 'Continue last game', 'Quit'], 24, screen_width, screen_height)
def main_menu(con, background_image, screen_width, screen_height): libtcod.image_blit_2x(background_image, 0, 0, 0) libtcod.console_set_default_foreground(0, libtcod.light_yellow) libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height / 2) - 4, libtcod.BKGND_NONE, libtcod.CENTER, 'BRAVE THE BOYD ORR') libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height / 2 + 4), libtcod.BKGND_NONE, libtcod.CENTER, 'By Lewis Dyer') menu(con, '', ['Play a new game', 'Continue last game', 'Quit'], 24, screen_width, screen_height)
def main_menu(con, background_image, screen_width, screen_height): libtcod.image_blit_2x(background_image, 0, 0, 0) libtcod.console_set_default_foreground(0, libtcod.light_yellow) libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height / 2) - 4, libtcod.BKGND_NONE, libtcod.CENTER, "*Stand-in Title*") libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height - 2), libtcod.BKGND_NONE, libtcod.CENTER, "AN EPQ project by Eoin McNeice") menu(con, "", ["New Game", "Continue Game", "Quit Game"], 24, screen_width, screen_height)
def main_menu(con, background_image, screen_width, screen_height): libtcod.image_blit_2x(background_image, 0, 0, 0) libtcod.console_set_default_foreground(0, libtcod.light_yellow) libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height / 2) - 4, libtcod.BKGND_NONE, libtcod.CENTER, 'We Be Goblins\n(Pathfinder no copyright pls)') libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height - 2), libtcod.BKGND_NONE, libtcod.CENTER, 'By Cole aka The Best') menu(con, '', ['Play a new game', 'Continue last game', 'Quit'], 24, screen_width, screen_height)
def main_menu(con, background_image, screen_width, screen_height): """Title/Main Menu""" libtcod.image_blit_2x(background_image, 0, 0, 0) libtcod.console_set_default_foreground(0, libtcod.light_yellow) libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height / 2) - 4, libtcod.BKGND_NONE, libtcod.CENTER, "TOMB OF THE JUNGLE KING") libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height - 2), libtcod.BKGND_NONE, libtcod.CENTER, "By Adam (yes him!)") menu(con, '', ['New Game', 'Continue', 'Quit'], 24, screen_width, screen_height)
def main_menu(con, background_image, screen_width, screen_height): libtcod.image_blit_2x(background_image, 0, 0, 0) libtcod.console_set_default_foreground(0, libtcod.light_yellow) libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height - 2) - 4, libtcod.BKGND_NONE, libtcod.CENTER, 'OHEYCOOL IT DIDNT CRASH ON STARTUP!') libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height - 2), libtcod.BKGND_NONE, libtcod.CENTER, 'Waveform Studios') menu(con, '', ['Play a new game', 'Continue last game', 'Quit'], 24, screen_width, screen_height)
def main_menu(con, background_image, screen_width, screen_height): # the main menu with background image libtcod.image_blit_2x(background_image, 0, 0, 0) libtcod.console_set_default_foreground(0, libtcod.light_yellow) libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height / 2) - 4, libtcod.BKGND_NONE, libtcod.CENTER, 'DUNGEONS OF GEHENNA') libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height - 2), libtcod.BKGND_NONE, libtcod.CENTER, 'By <name here>') menu(con, '', ['New game', 'Continue last game', 'Quit'], 24, screen_width, screen_height)
def display_main_menu(img): #show the background image, at twice the regular console resolution libtcod.image_blit_2x(img, 0, 0, 0) #show the game's title, and some credits! libtcod.console_set_default_foreground(0, libtcod.light_pink) libtcod.console_print_ex(0, cfg.SCREEN_WIDTH / 2, cfg.SCREEN_HEIGHT / 2 - 4, libtcod.BKGND_NONE, libtcod.CENTER, 'M O N S T E R G E N E T I C S') libtcod.console_print_ex(0, cfg.SCREEN_WIDTH / 2, cfg.SCREEN_HEIGHT - 4, libtcod.BKGND_NONE, libtcod.CENTER, 'By MiseryMyra') libtcod.console_print_ex(0, cfg.SCREEN_WIDTH / 2, cfg.SCREEN_HEIGHT - 2, libtcod.BKGND_NONE, libtcod.CENTER, 'Version ' + cfg.VERSION_NUMBER)
def end_menu(con, background_image, player, screen_width, screen_height): ''' Creates End Game Menu ''' libtcod.image_blit_2x(background_image, 0, 0, 0) # create off-screen console that represents menu window window = libtcod.console_new(screen_width - 20, screen_height - 20) libtcod.console_set_default_foreground(0, libtcod.white) libtcod.console_set_default_foreground(window, libtcod.white) x = int(screen_width / 2) y = int(screen_height / 2) libtcod.console_print_ex(window, x - 15, y - 23, libtcod.BKGND_NONE, libtcod.CENTER, 'CONGRATULATIONS') libtcod.console_print_ex(window, x - 15, y - 18, libtcod.BKGND_NONE, libtcod.CENTER, 'AFTER 50 DANGEROUS FLOORS OF MONSTERS AND') libtcod.console_print_ex(window, x - 15, y - 16, libtcod.BKGND_NONE, libtcod.CENTER, 'DEATH, YOU FINALLY REACH THE CENTER OF') libtcod.console_print_ex(window, x - 15, y - 14, libtcod.BKGND_NONE, libtcod.CENTER, 'JOTUNHEIM. BEFORE YOU, LIE UNIMAGINABLE') libtcod.console_print_ex(window, x - 15, y - 12, libtcod.BKGND_NONE, libtcod.CENTER, 'TREASURES AND WEALTH - RICHES THE LIKES') libtcod.console_print_ex(window, x - 15, y - 10, libtcod.BKGND_NONE, libtcod.CENTER, 'OF WHICH NO ONE IN THE NINE REALMS HAS') libtcod.console_print_ex(window, x - 15, y - 8, libtcod.BKGND_NONE, libtcod.CENTER, 'EVER SEEN. AND THEY ALL BELONG TO YOU NOW...') libtcod.console_print_ex(window, x - 15, y - 4, libtcod.BKGND_NONE, libtcod.CENTER, 'THANK YOU FOR PLAYING') libtcod.console_print_ex(0, x, int(screen_height - 2) - 2, libtcod.BKGND_NONE, libtcod.CENTER, 'DESCENT INTO JOTUNHEIM') libtcod.console_print_ex(0, x, int(screen_height - 2), libtcod.BKGND_NONE, libtcod.CENTER, 'BY DAVID KOHLER') libtcod.console_blit(window, 0, 0, 50, 25, 0, x - 25, y - 20, 1.0, 0.7) menu(con, '', ['QUIT'], 24, screen_width, screen_height + 20)
def main_menu(con, background_image, screen_width, screen_height): ''' Creates Main Menu ''' libtcod.image_blit_2x(background_image, 0, 0, 0) libtcod.console_set_default_foreground(0, libtcod.light_yellow) libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height / 2) - 4, libtcod.BKGND_NONE, libtcod.CENTER, 'DESCENT INTO JOTUNHEIM') libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height - 2) - 1, libtcod.BKGND_NONE, libtcod.CENTER, 'BY DAVID KOHLER') menu(con, '', ['NEW GAME', 'CONTINUE', 'RULES', 'QUIT'], 24, screen_width, screen_height + 5)
def blit_2x(self, console, dest_x=0, dest_y=0, x=0, y=0, width=None, height=None): if width is None: width = self.width if height is None: height = self.height return libtcod.image_blit_2x(self.image_id, console.console_id, dest_x, dest_y, x, y, width, height)
def showWelcomeScreen(self): #store the current view behind_window = libtcod.console_new(SCREEN_WIDTH, SCREEN_HEIGHT) libtcod.console_blit(0, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, behind_window, 0, 0, 1.0, 1.0) #show the background image, at twice the regular console resolution img = libtcod.image_load('./media/menu_background.png') libtcod.image_blit_2x(img, 0, 0, 0) while not libtcod.console_is_window_closed(): #show options and wait for the player's choice choice = self.showMenu( 'Main menu:\n----------', [ 'Start a new game', # Choice 0 'Continue previous game', # Choice 1 'Go to debug mode', # Choice 2 'Quit' ], # Choice 3 36) #interpret choice if choice is None: continue if choice == 0: print "Start a new game" self.newGame() self.showGameScreen() continue elif choice == 1: print "Continue previous game" self.showMessage('Oops...', 'I don\'t know how to load a game yet :-)', 36) elif choice == 2: # quit print "Go to debug mode" self.showDebugScreen() elif choice == 3: print "Quiting" break #Clean up (restore whatever was behind this window) libtcod.console_blit(behind_window, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0, 0, 1.0, 1.0) libtcod.console_flush()
def render_main_menu(self): img = tcod.image_load('static/menu_background.png') choice = EXIT_GAME while not tcod.console_is_window_closed(): # show the background image, at twice the regular console resolution tcod.image_blit_2x(img, 0, 0, 0) # game name and credits tcod.console_set_default_foreground(0, tcod.light_yellow) tcod.console_print_ex(0, int(SCREEN_WIDTH / 2), int(SCREEN_HEIGHT / 2 - 4), tcod.BKGND_NONE, tcod.CENTER, GAME_NAME) tcod.console_print_ex(0, int(SCREEN_WIDTH / 2), SCREEN_HEIGHT - 2, tcod.BKGND_NONE, tcod.CENTER, AUTHOR) # show options and wait for the player's choice choice = self.menu( '', ['Play a new game', 'Continue last game', 'Quit'], 24) return choice
def main_menu(con, background_image, screen_width, screen_height, colors, in_game=False): """Main menu screen with options to choose from.""" libtcod.image_blit_2x(background_image, 0, 0, 0) libtcod.console_set_default_foreground(0, colors['text_special']) libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height / 2) - 4, libtcod.BKGND_NONE, libtcod.CENTER, 'SURPRISE PEACH') libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height - 2), libtcod.BKGND_NONE, libtcod.CENTER, 'by iiu') menu(con, '', ['new game', 'continue last game', 'quit'], 24, screen_width, screen_height, colors, in_game)
def main_menu(): global con con = libtcod.console_new(g.SCREEN_WIDTH, g.SCREEN_HEIGHT) libtcod.console_set_custom_font( 'arial10x10.png', libtcod.FONT_TYPE_GREYSCALE | libtcod.FONT_LAYOUT_TCOD) libtcod.console_init_root(g.SCREEN_WIDTH, g.SCREEN_HEIGHT, 'python/libtcod tutorial', False) libtcod.sys_set_fps(g.LIMIT_FPS) img = libtcod.image_load('menu_background1.png') # show the background image, at twice the regular console resolution while not libtcod.console_is_window_closed(): # show the background image, at twice the regular console resolution libtcod.image_blit_2x(img, 0, 0, 0) # show the game's title, and some credits! libtcod.console_set_default_foreground(0, libtcod.light_yellow) libtcod.console_print_ex(0, g.SCREEN_WIDTH / 2, g.SCREEN_HEIGHT / 2 - 4, libtcod.BKGND_NONE, libtcod.CENTER, 'SNAKES IN THE DUNGEON') libtcod.console_print_ex(0, g.SCREEN_WIDTH / 2, g.SCREEN_HEIGHT - 2, libtcod.BKGND_NONE, libtcod.CENTER, 'by whothefuckcares') # show options and wait for the player's choice choice = menu('', ['Play a new game', 'Continue last game', 'Quit'], 24) if choice == 0: # new game new_game() play_game() if choice == 1: # load last game try: load_game() except: msgbox('\n No saved game to load.\n', 24) continue play_game() elif choice == 2: # quit break
def main_menu(): img = libtcod.image_load('menu_background.png') while not libtcod.console_is_window_closed(): libtcod.image_blit_2x(img, 0, 0, 0) libtcod.console_set_default_foreground(0, libtcod.light_yellow) libtcod.console_print_ex(0, SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2 - 4, libtcod.BKGND_NONE, libtcod.CENTER, 'ROGUELIKE') libtcod.console_print_ex(0, SCREEN_WIDTH / 2, SCREEN_HEIGHT - 2, libtcod.BKGND_NONE, libtcod.CENTER, '') choice = menu('', ['Play a game', 'Quit'], 24) if choice == 0: new_game() play_game() elif choice == 1: break
def character_creation_menu(background_image, screen_width, screen_height, character_name): libtcod.image_blit_2x(background_image, 0, 0, 0) libtcod.console_set_default_foreground(0, libtcod.light_yellow) libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height / 4) - 4, libtcod.BKGND_NONE, libtcod.CENTER, 'NEW GAME : CREATION SCREEN') libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height / 4), libtcod.BKGND_NONE, libtcod.CENTER, character_name) libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height - 5), libtcod.BKGND_NONE, libtcod.CENTER, 'Press ENTER to validate') libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height - 4), libtcod.BKGND_NONE, libtcod.CENTER, 'Press ESC for Main Menu')
def main_menu(con, background_image, screen_width, screen_height): """ Creates the main menu and uses menu() to blit it to the console. :param con: :param background_image: :param screen_width: :param screen_height: """ libtcod.image_blit_2x(background_image, 0, 0, 0) libtcod.console_set_default_foreground(0, libtcod.light_yellow) libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height / 2) - 4, libtcod.BKGND_NONE, libtcod.CENTER, "THE ADVENTURES OF KRULL") libtcod.console_print_ex(0, int(screen_width / 2), int(screen_height - 3), libtcod.BKGND_NONE, libtcod.CENTER, "By Daniel Bane") menu(con, "", ["Start new game", "Continue last game", "Quit"], 24, screen_width, screen_height)