Added out of map cells as obstacles

This commit is contained in:
Anna Nowak 2019-03-25 12:58:06 +01:00
parent c537d6c581
commit dd6a57c701
2 changed files with 7 additions and 0 deletions

View File

@ -29,6 +29,7 @@ display.set_caption('Smieciarz WMI')
utils.generate_grass(all_sprites) utils.generate_grass(all_sprites)
utils.generate_houses(all_sprites, obstacles_coords) utils.generate_houses(all_sprites, obstacles_coords)
utils.generate_landfills(all_sprites, obstacles_coords) utils.generate_landfills(all_sprites, obstacles_coords)
utils.add_frame_as_obstacles(obstacles_coords)
gc = utils.generate_garbage_collector(all_sprites, obstacles_coords) gc = utils.generate_garbage_collector(all_sprites, obstacles_coords)
## ##

View File

@ -12,6 +12,12 @@ from sprites.garbage_collector import Garbage_collector
def generate_rand_coordinates(max_x, max_y): def generate_rand_coordinates(max_x, max_y):
return (random.randint(0, max_x), random.randint(0, (max_y))) return (random.randint(0, max_x), random.randint(0, (max_y)))
def add_frame_as_obstacles(obstacles_coords):
for x in range(0, home_amount + 1):
obstacles_coords.append((x,-1))
obstacles_coords.append((-1,x))
obstacles_coords.append((PLAY_WIDTH//CELL_SIZE,x))
obstacles_coords.append((x,PLAY_HEIGHT//CELL_SIZE))
##GENERATE GRASS################################################################## ##GENERATE GRASS##################################################################
def generate_grass(all_sprites): def generate_grass(all_sprites):