Added out of map cells as obstacles
This commit is contained in:
parent
c537d6c581
commit
dd6a57c701
1
game.py
1
game.py
@ -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)
|
||||||
##
|
##
|
||||||
|
|
||||||
|
6
utils.py
6
utils.py
@ -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):
|
||||||
|
Loading…
Reference in New Issue
Block a user