def create_board_wizard(): global game global is_modified game.clear_screen() print( Utils.blue_bright("\t\tNew board") ) print("First we need some information on your new board:") name = str( input('Name: ') ) width = int( input_digit('Width (in number of cells): ') ) height = int( input_digit('Height (in number of cells): ') ) game.add_board(1, Board(name=name,size=[width,height], ui_borders=Utils.WHITE_SQUARE,ui_board_void_cell=Utils.BLACK_SQUARE) ) is_modified=True
def create_board_wizard(): global game global is_modified global current_file global default_map_dir game.clear_screen() print(Utils.blue_bright("\t\tNew board")) print("First we need some information on your new board:") name, width, height = None, None, None if game.config( "settings")["last_used_board_parameters"]["name"] is not None: name = game.config("settings")["last_used_board_parameters"]["name"] else: name = "New Board" name = str(input(f"Name (default: {name}): ")) or name if game.config( "settings")["last_used_board_parameters"]["width"] is not None: width = game.config("settings")["last_used_board_parameters"]["width"] else: width = 20 width = int( input_digit(f"Width (in number of cells) (default: {width}): ") or width) if game.config( "settings")["last_used_board_parameters"]["height"] is not None: height = game.config( "settings")["last_used_board_parameters"]["height"] else: height = 20 height = int( input_digit(f"Height (in number of cells) (default: {height}): ") or height) game.add_board( 1, Board( name=name, size=[width, height], ui_borders=Utils.WHITE_SQUARE, ui_board_void_cell=Utils.BLACK_SQUARE, ), ) is_modified = True current_file = os.path.join(default_map_dir, name.replace(" ", "_") + ".json") game.config("settings")["last_used_board_parameters"] = { "name": name, "width": width, "height": height, } if game.get_board(1).size[0] > 20 or game.get_board(1).size[1] > 20: game.enable_partial_display = True game.partial_display_viewport = [10, 10]
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}!")
sprite_wall = Sprites.WALL sprite_npc = Sprites.SKULL sprite_npc2 = Sprites.POO sprite_heart = Sprites.HEART_SPARKLING sprite_heart_minor = Sprites.HEART_BLUE else: # sprite_player = Utils.RED_BLUE_SQUARE sprite_portal = Utils.CYAN_SQUARE sprite_treasure = Utils.YELLOW_RECT + Utils.RED_RECT sprite_treasure2 = Utils.yellow_bright('$$') sprite_tree = Utils.GREEN_SQUARE sprite_wall = Utils.WHITE_SQUARE sprite_npc = Utils.magenta_bright("oO") sprite_npc2 = Utils.magenta_bright("'&") sprite_heart = Utils.red_bright('<3') sprite_heart_minor = Utils.blue_bright('<3') # Here are some functions to manage the game # This one clear the screen, print the game title, print the player stats, # display the current board, print the inventory and print the menu. 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)
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}!")