def runEndGame(): messager.addMessage("You have passed Trigger's gauntlet!") messager.addMessage("You escape into the Net, discovering freedom...") while messager.moreMessages(): messager.nextMessage() libtcod.console_flush() libtcod.console_wait_for_keypress(True) print "I... have quite perished... yet..." exit()
while not libtcod.console_is_window_closed(): libtcod.console_set_foreground_color(0, libtcod.white) #clear the player's old position libtcod.console_print_left(0, player.X, player.Y, libtcod.BKGND_NONE, ' ') #print terrain for y in range(len(saturnSeven.floor[player.Z][0])): for x in range(len(saturnSeven.floor[player.Z])): symbol = saturnSeven.getTerrainSymbol(x, y, player.Z) libtcod.console_print_left(0, x, y, libtcod.BKGND_NONE, symbol) libtcod.console_print_left(0, player.X, player.Y, libtcod.BKGND_NONE, '@') statusinfo.updateDisplay(player) inventory.updateDisplay() messager.nextMessage() libtcod.console_flush() #handle input (player moves first, if he moves at all) key = libtcod.console_wait_for_keypress(True) inputValid = input.handleInput(player, key, saturnSeven) libtcod.console_flush() if not inputValid: continue player.tick() enemiesToRemove = [] #Eliminate old enemies for enemy in entity.enemies: if enemy.dead: enemiesToRemove.append(enemy) x, y, z = enemy.X, enemy.Y, enemy.Z saturnSeven.floor[z][x][y].entity = None