Śmieciarka może wjeżdżać do domów
This commit is contained in:
parent
b1450df77c
commit
1ece7bce0f
BIN
res/tiles.png
BIN
res/tiles.png
Binary file not shown.
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 14 KiB |
@ -1,6 +1,6 @@
|
|||||||
class Agent:
|
class Agent:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
graph = []
|
self.graph = []
|
||||||
|
|
||||||
def inform(self, coordinate_set):
|
def inform(self, coordinate_set):
|
||||||
pass
|
pass
|
||||||
|
@ -36,7 +36,7 @@ class TruckEntity(Entity):
|
|||||||
proposed_pos = self.position + move_vector
|
proposed_pos = self.position + move_vector
|
||||||
move_valid = True
|
move_valid = True
|
||||||
|
|
||||||
if proposed_pos not in self.state.roads_pos:
|
if proposed_pos not in self.state.roads_pos and proposed_pos not in self.state.houses_pos:
|
||||||
move_valid = False
|
move_valid = False
|
||||||
if proposed_pos.x < 0 or proposed_pos.x >= self.state.world_limits.x:
|
if proposed_pos.x < 0 or proposed_pos.x >= self.state.world_limits.x:
|
||||||
move_valid = False
|
move_valid = False
|
||||||
@ -76,7 +76,6 @@ class SimulationState:
|
|||||||
|
|
||||||
if tile == "O":
|
if tile == "O":
|
||||||
self.truck_origin = pg.Vector2(x, y)
|
self.truck_origin = pg.Vector2(x, y)
|
||||||
self.entities.append(TruckEntity(self, self.truck_origin))
|
|
||||||
self.roads_pos.append(pg.Vector2(x, y))
|
self.roads_pos.append(pg.Vector2(x, y))
|
||||||
if tile == "R":
|
if tile == "R":
|
||||||
self.roads_pos.append(pg.Vector2(x, y))
|
self.roads_pos.append(pg.Vector2(x, y))
|
||||||
@ -95,6 +94,7 @@ class SimulationState:
|
|||||||
if tile == "Z":
|
if tile == "Z":
|
||||||
self.mixed_dump_pos = 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(DumpEntity(self, pg.Vector2(x, y), 'mixed'))
|
||||||
|
self.entities.append(TruckEntity(self, self.truck_origin))
|
||||||
|
|
||||||
self.world_limits = pg.Vector2(max_x, max_y)
|
self.world_limits = pg.Vector2(max_x, max_y)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user