def refresh_screen(mygame, player, menu): mygame.clear_screen() # print(Utils.magenta_bright(f"\t\t~+~ Welcome to {mygame.name} ~+~")) mygame.display_player_stats() mygame.display_board() if player.inventory.size() > 0: # If inventory is not empty print it items_by_type = {} for item_name in player.inventory.items_name(): item = player.inventory.get_item(item_name) if item.type in items_by_type.keys(): items_by_type[item.type]['cumulated_size'] += item.size() else: items_by_type[item.type] = { 'cumulated_size': item.size(), 'model': item.model, 'name': item.name, } count = 1 for k in items_by_type.keys(): print(f" {items_by_type[k]['model']} : \ {items_by_type[k]['cumulated_size']} ", end='') count += 1 if count == 5: count = 0 print("\n", end='') print("\n", end='') print( Utils.yellow_dim('\nWhere should ') + Utils.cyan_bright(player.name) + Utils.yellow_dim(' go?')) mygame.display_menu(menu) Utils.debug(f"Player stored position is ({player.pos[0]},{player.pos[1]})")
import examples_includes # noqa: F401 # First import the Utils module import gamelib.Utils as Utils # Then get creative! # you directly print colored messages: print(Utils.magenta_bright("This is a rather flashy magenta...")) # Each color function has 3 variations : regular, dim and bright print(Utils.yellow_dim("This is dim.")) print(Utils.yellow("This is regular.")) print(Utils.yellow_bright("This is bright.")) # Now, the color functions are just that: functions. So you can store the # results in a variable and use them: blue = Utils.blue_bright("blue") white = Utils.white_bright("white") red = Utils.red_bright("red") print(f"France's flag is {blue} {white} {red}!")
import examples_includes # First import the Utils module import gamelib.Utils as Utils # Then get creative! # you directly print colored messages: print("France flag is "+Utils.blue_bright('blue ')+Utils.white_bright('white ')+Utils.red_bright('red')+"!") # Each color function has 3 variations : regular, dim and bright print( Utils.yellow_dim('This is dim.')+Utils.yellow(' This is regular.')+Utils.yellow_bright(' This is bright.') ) # Now, the color functions are just that: functions. So you can store the results in a variable and use them: flashymagy = Utils.magenta_bright('This is a rather flashy magenta...') print('Now that is a colored message in a variable: '+flashymagy)
import examples_includes # First import the Utils module import gamelib.Utils as Utils # Then get creative! # you directly print colored messages: print(Utils.magenta_bright('This is a rather flashy magenta...')) # Each color function has 3 variations : regular, dim and bright print(Utils.yellow_dim('This is dim.')) print(Utils.yellow('This is regular.')) print(Utils.yellow_bright('This is bright.')) # Now, the color functions are just that: functions. So you can store the # results in a variable and use them: blue = Utils.blue_bright('blue') white = Utils.white_bright('white') red = Utils.red_bright('red') print(f"France's flag is {blue} {white} {red}!")