SI_projekt_smieciarka/trash.py
Michal Zmudzinski 5289c48fe2 Game
2021-06-13 15:14:55 +02:00

17 lines
507 B
Python

import random
from house import is_house
class Trash:
def __init__(self, grid_w, grid_h, grid_size):
self.grid_w = grid_w
self.grid_h = grid_h
self.size = grid_size
def new_pos(self, truck_pos, houses):
while True:
self.pos = [random.randrange(0, self.grid_w, self.size),
random.randrange(0, self.grid_h, self.size)]
if self.pos != truck_pos and not is_house(self.pos, houses):
break