Śmieciarka może wjeżdżać na wysypisko
This commit is contained in:
parent
1ece7bce0f
commit
681719df65
@ -36,7 +36,9 @@ class TruckEntity(Entity):
|
||||
proposed_pos = self.position + move_vector
|
||||
move_valid = True
|
||||
|
||||
if proposed_pos not in self.state.roads_pos and proposed_pos not in self.state.houses_pos:
|
||||
if proposed_pos not in self.state.roads_pos \
|
||||
and proposed_pos not in self.state.houses_pos \
|
||||
and proposed_pos not in self.state.dumps_pos:
|
||||
move_valid = False
|
||||
if proposed_pos.x < 0 or proposed_pos.x >= self.state.world_limits.x:
|
||||
move_valid = False
|
||||
@ -63,6 +65,7 @@ class SimulationState:
|
||||
def __init__(self):
|
||||
self.roads_pos = []
|
||||
self.houses_pos = []
|
||||
self.dumps_pos = []
|
||||
self.entities = []
|
||||
|
||||
map_path = Path("../res/map.txt")
|
||||
@ -83,15 +86,19 @@ class SimulationState:
|
||||
self.houses_pos.append(pg.Vector2(x, y))
|
||||
self.entities.append(HouseEntity(self, pg.Vector2(x, y)))
|
||||
if tile == "M":
|
||||
self.dumps_pos.append(pg.Vector2(x, y))
|
||||
self.paper_dump_pos = pg.Vector2(x, y)
|
||||
self.entities.append(DumpEntity(self, pg.Vector2(x, y), 'paper'))
|
||||
if tile == "P":
|
||||
self.dumps_pos.append(pg.Vector2(x, y))
|
||||
self.plastic_dump_pos = pg.Vector2(x, y)
|
||||
self.entities.append(DumpEntity(self, pg.Vector2(x, y), 'plastic'))
|
||||
if tile == "S":
|
||||
self.dumps_pos.append(pg.Vector2(x, y))
|
||||
self.glass_dump_pos = pg.Vector2(x, y)
|
||||
self.entities.append(DumpEntity(self, pg.Vector2(x, y), 'glass'))
|
||||
if tile == "Z":
|
||||
self.dumps_pos.append(pg.Vector2(x, y))
|
||||
self.mixed_dump_pos = pg.Vector2(x, y)
|
||||
self.entities.append(DumpEntity(self, pg.Vector2(x, y), 'mixed'))
|
||||
self.entities.append(TruckEntity(self, self.truck_origin))
|
||||
|
Loading…
Reference in New Issue
Block a user