def generate_world(combat_test=False): _menu = MENUS[menus.get_menu_by_name('World Generation')] _settings = {} for entry in _menu['menu']: _settings[entry['key']] = entry['values'][entry['value']] if _settings['Map'] == 'Generate Map': _settings['Map'] = mapgen.generate_map(towns=1, factories=0, outposts=2, forests=1)['name'] if _settings['World Age'] == 'Day 0': _ticks = 10 elif _settings['World Age'] == '1 Week': _ticks = 1000 #30000 elif _settings['World Age'] == '2 Weeks': _ticks = 2000 elif _settings['World Age'] == '3 Weeks': _ticks = 3000 elif _settings['World Age'] == '4 Weeks': _ticks = 4000 elif _settings['World Age'] == '5 Weeks': _ticks = 5000 maps.load_map(_settings['Map'], cache_map=True) worldgen.generate_world(WORLD_INFO['map'], dynamic_spawns=_settings['Dynamic Spawns'], wildlife_spawns=_settings['Wildlife Density'], simulate_ticks=_ticks, save=True, thread=True)
def generate_world(combat_test=False): _menu = MENUS[menus.get_menu_by_name('World Generation')] _settings = {} for entry in _menu['menu']: _settings[entry['key']] = entry['values'][entry['value']] if _settings['Map'] == 'Generate Map': _settings['Map'] = mapgen.generate_map(towns=1, factories=0, outposts=2, forests=1)['name'] if _settings['World Age'] == 'Day 0': _ticks = 10 elif _settings['World Age'] == '1 Week': _ticks = 1000#30000 elif _settings['World Age'] == '2 Weeks': _ticks = 2000 elif _settings['World Age'] == '3 Weeks': _ticks = 3000 elif _settings['World Age'] == '4 Weeks': _ticks = 4000 elif _settings['World Age'] == '5 Weeks': _ticks = 5000 maps.load_map(_settings['Map'], cache_map=True) worldgen.generate_world(WORLD_INFO['map'], dynamic_spawns=_settings['Dynamic Spawns'], wildlife_spawns=_settings['Wildlife Density'], simulate_ticks=_ticks, save=True, thread=True)
def menu_item_selected(entry): if MENUS: menus.delete_active_menu() gfx.title('Loading...') pre_setup_world() maps.load_map(entry['key']) post_setup_world() SETTINGS['running'] = 2
def add_to_maps(map): """ Adds maps to the list if the map is newly created, if modified it updates the values """ newbut = True for but in menu_buttons["level_editor"]: #Checks if map exists if isinstance(but, ui.Button) and but.val == map: newbut = False if newbut == True: start_y = 220 + (len(maps.map_list) - 1) * 35 but = ui.Button("map", screen_width / 2 - 75, start_y, 150, 30, font_20, map, black, white, gray, map) menu_buttons["map_selection"].append(but) menu_buttons["level_editor"].append(but) maps.load_map(map)
def load_world(world): global LOADED_CHUNKS gfx.title('Loading...') LOADED_CHUNKS = {} WORLD_INFO['id'] = world maps.load_map('map', base_dir=profiles.get_world_directory(world)) logging.debug('Loading life from disk...') with open( os.path.join(profiles.get_world_directory(WORLD_INFO['id']), 'life.dat'), 'r') as e: LIFE.update(json.loads(e.readline())) logging.debug('Loading items from disk...') with open( os.path.join(profiles.get_world_directory(WORLD_INFO['id']), 'items.dat'), 'r') as e: ITEMS.update(json.loads(e.readline())) logging.debug('Loading historic items...') #with open(os.path.join(profiles.get_world_directory(WORLD_INFO['id']), 'items_history.dat'), 'r') as e: # ITEMS_HISTORY.update(json.loads(''.join(e.readlines()))) maps.reset_lights() SETTINGS['controlling'] = None SETTINGS['following'] = None for life in LIFE.values(): if life['dead']: continue if 'player' in life: SETTINGS['controlling'] = life['id'] lfe.focus_on(life) break lfe.load_all_life() items.reload_all_items() if SETTINGS['chunk_handler']: SETTINGS['chunk_handler'].check_chunks(force=True) #logging.debug('Rendering map slices...') #maps.render_map_slices() logging.info('World loaded.')
def start(self): pygame.init() self.window = pygame.display.set_mode(self.win_dim) pygame.display.set_caption(self.game_name) clock = pygame.time.Clock() self.my_scene_selector = manager.SceneSelector() my_map = maps.load_map("map1.txt", (128, 256)) self.current_scene = world.WorldScene(self, "world-scene", my_map) self.my_scene_selector.add_scene(self.current_scene) self.my_scene_selector.select("world-scene") self.current_scene.load() self.play = True while self.play: clock.tick(60) events = pygame.event.get() for event in events: if event.type == pygame.QUIT: self.play = False self.current_scene.control(events) self.current_scene.tick() self.current_scene.render(self.window) pygame.quit()
def commands(): global MAP if controls.key_pressed('s'): maps.save_map('test', MAP) elif controls.key_pressed('l'): MAP = maps.load_map('test')
def load_world(world): global LOADED_CHUNKS gfx.title('Loading...') LOADED_CHUNKS = {} WORLD_INFO['id'] = world maps.load_map('map', base_dir=profiles.get_world_directory(world)) logging.debug('Loading life from disk...') with open(os.path.join(profiles.get_world_directory(WORLD_INFO['id']), 'life.dat'), 'r') as e: LIFE.update(json.loads(e.readline())) logging.debug('Loading items from disk...') with open(os.path.join(profiles.get_world_directory(WORLD_INFO['id']), 'items.dat'), 'r') as e: ITEMS.update(json.loads(e.readline())) logging.debug('Loading historic items...') #with open(os.path.join(profiles.get_world_directory(WORLD_INFO['id']), 'items_history.dat'), 'r') as e: # ITEMS_HISTORY.update(json.loads(''.join(e.readlines()))) maps.reset_lights() SETTINGS['controlling'] = None SETTINGS['following'] = None for life in LIFE.values(): if life['dead']: continue if 'player' in life: SETTINGS['controlling'] = life['id'] lfe.focus_on(life) break lfe.load_all_life() items.reload_all_items() if SETTINGS['chunk_handler']: SETTINGS['chunk_handler'].check_chunks(force=True) #logging.debug('Rendering map slices...') #maps.render_map_slices() logging.info('World loaded.')
def _main(): _targets = [{'position': (40,30),'score': 50}] MAP = maps.load_map('map1.dat') _a = create_dijkstra_map((44,26,2),MAP,_targets) _stime = time.time() generate_dijkstra_map(_a) invert_dijkstra_map(_a) print time.time()-_stime draw_dijkstra(_a) _path = pathfinding.path_from_dijkstra((43,30,2),_a,downhill=False) draw_dijkstra(_a,path=_path)
def start(self): # call this function when restarting the game # to avoid recursion self.all_sprites = pg.sprite.Group() self.mobs = pg.sprite.Group() self.shooters = pg.sprite.Group() self.bullets = pg.sprite.Group() self.game_lost = False self.money = st.STARTING_MONEY self.lives = st.STARTING_LIVES self.current_wave = 0 self.wave_spawner = mp.Wave(self) self.elapsed_seconds = 0 # load objects from tmx data self.bg_image, map_objects = mp.load_map('level2') self.roads = [] self.nodes = [] self.walls = [] for obj in map_objects: if obj.name == 'Road': self.roads.append(spr.Road(obj.x, obj.y, obj.width, obj.height)) elif obj.name == 'node': self.nodes.append( mp.Node(self, (obj.x, obj.y), (obj.width, obj.height))) elif obj.name == 'Wall': self.walls.append( mp.Wall(self, (obj.x, obj.y), (obj.width, obj.height))) self.map_rect = self.bg_image.get_rect() self.map_rect.topleft = (0, 0) self.start_node = mp.Node(self, (-2 * st.TILESIZE, self.map_rect.h // 2), (64, 64)) self.end_node = mp.Node(self, (41 * st.TILESIZE, self.map_rect.h // 2), (64, 64)) self.nodes.append(self.start_node) self.nodes.append(self.end_node) for node in self.nodes: node.find_neighbors() # find paths along the nodes self.paths = mp.find_paths(self.start_node, self.end_node) self.selected_shooter = next(st.shooter_it) self.camera = Camera(self)
def main(): t0 = time.time() LIMA_MAP = './data/lima_map/limaPolyUTM.geojson' cfg_name = './config/_credentials.cfg' LOGGER_LEVEL = 10 N = 2000 cfg_parser = configparser.ConfigParser() cfg_parser.read(cfg_name) my_key = str(cfg_parser.get('key', 'key')) logger = config.config_logger(__name__, LOGGER_LEVEL) logger.info('Beginning execution: GOOGLE URBAN') logger.info('Logger configured - level {0}'.format(LOGGER_LEVEL)) logger.info('Logging in Google Maps API') gmaps = googlemaps.Client(key=my_key) logger.info('Opening Lima map: {0}'.format(LIMA_MAP)) lima_gpd = maps.load_map(LIMA_MAP) logger.info('Getting Lima limits') lima_limits = maps.boundaries(lima_gpd) logger.info('Plotting Lima map') save_path_lima_map = './data/lima_map/lima.png' maps.plot_map(lima_gpd, save_path_lima_map, lima_limits) logger.info('Getting {0} random starts'.format(N)) start_points = maps.get_list_of_random_starts(lima_gpd, lima_limits, n=N) logger.info('Plotting points in Lima map') save_path_lima_point = './data/lima_map/lima_start_points.png' maps.plot_map_and_points(lima_gpd, save_path_lima_point, start_points) logger.info('Converting UTM points into lat-lon points') start_points = maps.UTM_to_latlon(start_points) #TODO generate queries for trafic each hour #TODO automatize the code to send queries each hour. config.time_taken_display(t0)
def start_game(self): """ Une fois qu'assez de joueurs sont prêt on lance une partie via cette fonction. """ # Charge la carte pour laquelle les joueurs ont voté dans la partie self.map = maps.load_map(self.vote_map()) # Enlève les robots qui pourraient être présent par défaut sur la carte playstyle.remove_robots(self.map) # Choisi un robot et une position au hasard pour chaque joueur self.place_robots() # Boucle dans laquelle on demande aux joueurs leur action à effectué. # La boucle ne s'arrête que lorsqu'un joueur a trouvé la sortie. end = False while not end: for p in self.players: data = {"map": self.map, "msg": f"Awaiting {p.robot} move..."} self.send_all(data, [p]) msg = "Your turn to play : " valid_turn = False while not valid_turn: data = {"map": self.map, "end": end, "action": "makemove", "msg": msg} self.send_data_json(data, p) data = self.recv_data_json(p) print(f"Object received from player {p.addr} : {data}") end, valid_turn, msg = \ playstyle.play_turn(self.map, data["makemove"], p.robot) if end: p.is_winner = True break self.end_game()
def run(Display, map_name, size): import logging Map_Data = maps.load_map(map_name) if Map_Data == False: Map_Data = maps.new_maps(size) Pos_Ecran_Actuelle = [0, 0] Size = (Map_Data["size"][0]*32, Map_Data["size"][1]*32) Default_Sprite = entity.Sprite(pygame.Surface((32, 32))) ScreenSize = Display.get_rect() Maps_Surface = pygame.Surface(Size) Menu_Width = int(config.CFG["mapeditor.menu_width"]) Menu_Surface = pygame.Surface((Menu_Width*32, ScreenSize.height)) Pos_Menu_Surface = Menu_Surface.get_rect() Pos_Menu_Surface.x = ScreenSize.width - Menu_Width*32 pos_curs = (50, 50) Scheduler = pygame.time.Clock() SpriteGroup = entity.EntityGroup() ListeSprite = [] Position = 0 for Sp_i in sorted(ressource.SPRITE): if Sp_i < 1000: continue Sp = ressource.SPRITE[Sp_i] Pos_x = (Position%Menu_Width) * 32 Pos_y = (Position//Menu_Width) * 32 Position += 1 Menu_Surface.blit(Sp.image, (Pos_x, Pos_y)) ListeSprite.append({"id":Sp.data["ID"]}) Texture_Séléctionné = 0 GameRun = True while GameRun: for event in pygame.event.get(): #Attente des événements if event.type == MOUSEMOTION: pos_curs = event.pos if event.type == MOUSEBUTTONDOWN: if event.button == 1: clic_x = event.pos[0] clic_y = event.pos[1] if clic_x > Pos_Menu_Surface.x: # Si clique dans le menu de gauche bloc_x = (clic_x - Pos_Menu_Surface.x) // 32 bloc_y = (clic_y) // 32 Texture_Séléctionné = bloc_y*Menu_Width + bloc_x if clic_x < Pos_Menu_Surface.x: bloc_x = (Pos_Ecran_Actuelle[0] + clic_x) // 32 bloc_y = (Pos_Ecran_Actuelle[1] + clic_y) // 32 Id = int(ListeSprite[Texture_Séléctionné]["id"]) if bloc_y>=0 and bloc_y<len(Map_Data["data"]): if bloc_x>=0 and bloc_x<len(Map_Data["data"][bloc_y]): Map_Data["data"][bloc_y][bloc_x] = Id logging.debug("Bloc cliqué: %s %s %s"%(bloc_x, bloc_y, Id)) if event.button == 2: clic_x = event.pos[0] clic_y = event.pos[1] if clic_x < Pos_Menu_Surface.x: bloc_x = (Pos_Ecran_Actuelle[0] + clic_x) // 32 bloc_y = (Pos_Ecran_Actuelle[1] + clic_y) // 32 Id = Map_Data["data"][bloc_y][bloc_x] for i in range(0, len(ListeSprite)): if Id == ListeSprite[i]["id"]: Texture_Séléctionné = i logging.debug("Bloc pipette: %s %s %s %s"%(bloc_x, bloc_y, Id, Texture_Séléctionné)) if event.type == QUIT: maps.save_map(map_name, Map_Data) GameRun = False if event.type == KEYDOWN: if event.key == K_LEFT: divers.move_screen(Pos_Ecran_Actuelle, Size, ScreenSize, Menu_Width*32, (-15, 0)) if event.key == K_RIGHT: divers.move_screen(Pos_Ecran_Actuelle, Size, ScreenSize, Menu_Width*32, (15, 0)) if event.key == K_UP: divers.move_screen(Pos_Ecran_Actuelle, Size, ScreenSize, Menu_Width*32, (0, -15)) if event.key == K_DOWN: divers.move_screen(Pos_Ecran_Actuelle, Size, ScreenSize, Menu_Width*32, (0, 15)) if event.key == K_s: maps.save_map(map_name, Map_Data) if pos_curs[0] < 10: divers.move_screen(Pos_Ecran_Actuelle, Size, ScreenSize, Menu_Width*32, (-5, 0)) if pos_curs[0] > config.CFG["screen.size"][0]-10: divers.move_screen(Pos_Ecran_Actuelle, Size, ScreenSize, Menu_Width*32, (5, 0)) if pos_curs[1] < 10: divers.move_screen(Pos_Ecran_Actuelle, Size, ScreenSize, Menu_Width*32, (0, -5)) if pos_curs[1] > config.CFG["screen.size"][1]-10: divers.move_screen(Pos_Ecran_Actuelle, Size, ScreenSize, Menu_Width*32, (0, 5)) y=0 for y in range(0, Map_Data["size"][1]): for x in range(0, Map_Data["size"][0]): try: sprite = ressource.SPRITE[ Map_Data["data"][y][x] ] except Exception: sprite = Default_Sprite Maps_Surface.blit(sprite.image, (x*32, y*32)) SpriteGroup.draw(Maps_Surface) Pos_inversé = (-Pos_Ecran_Actuelle[0], -Pos_Ecran_Actuelle[1]) Display.blit(Maps_Surface, Pos_inversé) Display.blit(Menu_Surface, Pos_Menu_Surface) Pos_x = ScreenSize.width - Menu_Width*32 + ((Texture_Séléctionné%Menu_Width) * 32) Pos_y = (Texture_Séléctionné//Menu_Width) * 32 Display.blit(ressource.SPRITE[ 200 ].image, (Pos_x, Pos_y)) Scheduler.tick_busy_loop(int(config.CFG["screen.fps"])) pygame.display.flip() Maps_Surface.fill(0) Display.fill(0)
Created on Sep 10, 2013 @author: Dean, God Almighty of Sex ''' import pygame from pygame.sprite import Sprite import os, math, random, globals, functions, entities, maps pygame.init() pygame.display.set_caption('RPG Test') screen = pygame.display.set_mode((480,480)) done = False clock = pygame.time.Clock() clockcounter = 0 one = entities.player_map(1,1) maps.load_map(maps.setmap_world_map(0, 0)) while not done: key_pressed = pygame.key.get_pressed() if key_pressed[pygame.K_LEFT]: globals.player_map.keydown['LEFT'] = True globals.player_map.key_pressed = True else: globals.player_map.keydown['LEFT'] = False if key_pressed[pygame.K_RIGHT]: globals.player_map.keydown['RIGHT'] = True globals.player_map.key_pressed = True else: globals.player_map.keydown['RIGHT'] = False if key_pressed[pygame.K_UP]: globals.player_map.keydown['UP'] = True globals.player_map.key_pressed = True else: globals.player_map.keydown['UP'] = False
def engine(debug1 = False, debug2 = False, debug3 = False): # 7 on the map means food # file_handler.open_file("AboutMe.pdf") # Dictionary Detailing which type of event can happen event = { "Exit": 'E', # Represented as a 0 on an edge of the map only, there should be up to 2 Exits "Water": -1, # Any -1 is water "Land": 0, "Start Position": 1, # Marked as a Single 1 on the IslandMap "Food": 2, # Marked as a Single 2 on the map representing Food "Spikes": 4 } # Dictionary Detailing which map files available to read from in the folder TextFile = { "Map1": "map5-6.txt", "Map2": "map15-18.txt", "Map3": "map20-20.txt" } # Store Maps of Traveled paths for each different Event Outcome escaped_maps = [] starved_maps = [] drowned_maps = [] # Get Map Dimensions [row, col] : 2 Element List map_dimensions = maps.get_map_dim(TextFile["Map2"]) # Returns a 2 element list [row, col] # Populate 2D Maps: Island Layout, and movement_map to keep track of where it has traveled island_map = maps.load_map(TextFile["Map2"], map_dimensions) movement_map = maps.create_blank_map(map_dimensions) # Sets up to Two Bridges Position's on the Map navigation.update_bridge_pos(island_map, map_dimensions) # Store Initial Position [row, col] of the "Wanderer" initial_xy = navigation.get_pos(island_map, event["Start Position"]) # This block print to console where the events are on the map or if there are any of these events if debug1 or debug2 or debug3: print(f"\nInitial Position:{initial_xy}") # Display : Initial Position of Wanderer to the console # Store Position [row,col] : Food Element on the map food_xy = navigation.get_pos(island_map, event["Food"]) print("Food Positions", end=':') stats.print_event_positions(food_xy) # Store Position [row,col] : Spikes Element on the map spikes_xy = navigation.get_pos(island_map, event["Spikes"]) print(f"Spikes Positions", end=':') stats.print_event_positions(spikes_xy) # Begin : Set Movement Position to the Initial Position on the map movement_xy = copy.deepcopy(initial_xy) # Display : Map of the Island to the console for the user to see print("Island Map: ") maps.print_matrix(island_map) # Clear Initial Position on Island Map : Marking it as Land represented as 0 island_map[movement_xy[0]][movement_xy[1]] = 0 lives = 100 while lives > 0: lives -= 1 # Decrement Lives maps.clear_matrix(movement_map, map_dimensions) # Clear matrix to all 0 for next round movement_xy = copy.deepcopy(initial_xy) # Reset Back to Initial position movement_map[movement_xy[0]][movement_xy[1]] = 1 # Set initial position on movement map steps = int((map_dimensions[0] * map_dimensions[1]) >> 2) # Allowed Steps = (row * col) / 4 using shifting if debug3: print(f"Steps = {map_dimensions[0]} * {map_dimensions[1]} / 4 = {steps}") while steps > 0: # TODO Enable smart_move = True for better odds navigation.rand_update_movement_pos(movement_map, movement_xy, True) # Move in Random Direction steps -= 1 # Decrement Steps Counter if navigation.on_event_type(island_map, movement_xy, event["Food"]): steps += 2 # Food Replenish 2 steps worth of energy if debug3: print("Found Food Energy increased + 2") continue elif navigation.on_event_type(island_map, movement_xy, event["Spikes"]): steps -= 1 # Spikes Lose 1 step worth of energy if debug3: print("Oh No stepped on Spikes! Energy decreased -1") continue if navigation.on_event_type(island_map, movement_xy, event["Exit"]): stats.escaped_count += 1 escaped_maps.append(copy.deepcopy(movement_map)) break elif navigation.on_event_type(island_map, movement_xy, event["Water"]): stats.drowned_count += 1 drowned_maps.append(copy.deepcopy(movement_map)) break elif steps == 0: # Starved: When Wanderer runs out of steps stats.starved_count += 1 starved_maps.append(copy.deepcopy(movement_map)) break stats.print_all_stats() if debug1 or debug2 or debug3: if stats.escaped_count > 0: print(f"\nEscaped Maps: ") maps.print_list_of_maps(escaped_maps) if debug2 or debug3: if stats.starved_count > 0: print(f"\nStarved Maps: ") maps.print_list_of_maps(starved_maps) if debug3: if stats.drowned_count > 0: print(f"\nDrowned Maps: ") maps.print_list_of_maps(drowned_maps)
def run(Display, network, map_name): Map_Data = maps.load_map(map_name) Pos_Ecran_Actuelle = [0, 0] Size = (Map_Data["size"][0] * 32, Map_Data["size"][1] * 32) Maps_Surface = pygame.Surface(Size) ScreenSize = Display.get_rect() Menu_Width = 0 pos_curs = (50, 50) Default_Sprite = entity.Sprite(pygame.Surface((32, 32))) Scheduler = pygame.time.Clock() logging.info("Tentative de connection...") while True: if network.loginok: break time.sleep(0.1) logging.info("Connection ok...") network.join_room("serdtfyugiohjpk") while True: if network.room_joined: break time.sleep(0.1) network.create_entity(1, network.player_uuid, UUID.uuid4(), (random.randint(0, 10), random.randint(0, 10))) network.create_entity(1, network.player_uuid, UUID.uuid4(), (random.randint(0, 10), random.randint(0, 10))) logging.info("Lancement de la bouble principale...") Sprite_cliqué = False GameRun = True while GameRun: for event in pygame.event.get(): #Attente des événements if event.type == MOUSEMOTION: pos_curs = event.pos if event.type == MOUSEBUTTONDOWN: if event.button == 1: clic_x = event.pos[0] clic_y = event.pos[1] bloc_x = (Pos_Ecran_Actuelle[0] + clic_x) // 32 bloc_y = (Pos_Ecran_Actuelle[1] + clic_y) // 32 Sprite_cliqué = False for Player in network.Player_list.values(): for sprite in Player.Entity: sprite_x = sprite.rect.x // 32 sprite_y = sprite.rect.y // 32 if sprite_x == bloc_x and sprite_y == bloc_y: Sprite_cliqué = sprite logging.debug("Entitée cliqué: %s %s %s" % (bloc_x, bloc_y, Sprite_cliqué)) break if event.button == 3: clic_x = event.pos[0] clic_y = event.pos[1] bloc_x = (Pos_Ecran_Actuelle[0] + clic_x) // 32 bloc_y = (Pos_Ecran_Actuelle[1] + clic_y) // 32 if Sprite_cliqué: network.move_entity(Sprite_cliqué, (bloc_x, bloc_y)) logging.debug("Entitée déplacé: %s %s %s" % (bloc_x, bloc_y, Sprite_cliqué)) if event.type == QUIT: logging.info("Demande de fermeture...") GameRun = False if event.type == KEYDOWN: if event.key == K_LEFT: divers.move_screen(Pos_Ecran_Actuelle, Size, ScreenSize, Menu_Width * 32, (-15, 0)) if event.key == K_RIGHT: divers.move_screen(Pos_Ecran_Actuelle, Size, ScreenSize, Menu_Width * 32, (15, 0)) if event.key == K_UP: divers.move_screen(Pos_Ecran_Actuelle, Size, ScreenSize, Menu_Width * 32, (0, -15)) if event.key == K_DOWN: divers.move_screen(Pos_Ecran_Actuelle, Size, ScreenSize, Menu_Width * 32, (0, 15)) if event.key == K_s: maps.save_map(map_name, Map_Data) if pos_curs[0] < 10: divers.move_screen(Pos_Ecran_Actuelle, Size, ScreenSize, Menu_Width * 32, (-5, 0)) if pos_curs[0] > config.CFG["screen.size"][0] - 10: divers.move_screen(Pos_Ecran_Actuelle, Size, ScreenSize, Menu_Width * 32, (5, 0)) if pos_curs[1] < 10: divers.move_screen(Pos_Ecran_Actuelle, Size, ScreenSize, Menu_Width * 32, (0, -5)) if pos_curs[1] > config.CFG["screen.size"][1] - 10: divers.move_screen(Pos_Ecran_Actuelle, Size, ScreenSize, Menu_Width * 32, (0, 5)) y = 0 for y in range(0, Map_Data["size"][1]): for x in range(0, Map_Data["size"][0]): try: sprite = ressource.SPRITE[Map_Data["data"][y][x]] except Exception: sprite = Default_Sprite Maps_Surface.blit(sprite.image, (x * 32, y * 32)) for Player in network.Player_list.values(): Player.Entity.draw(Maps_Surface) Pos_inversé = (-Pos_Ecran_Actuelle[0], -Pos_Ecran_Actuelle[1]) Display.blit(Maps_Surface, Pos_inversé) Scheduler.tick_busy_loop(int(config.CFG["screen.fps"])) pygame.display.flip() Maps_Surface.fill(0) Display.fill(0)
def load_level(): global MAP MAP = maps.load_map('test') create_player()