mirror of
https://github.com/illiumst/marl-factory-grid.git
synced 2025-05-23 15:26:43 +02:00
Merge remote-tracking branch 'origin/main'
# Conflicts: # environments/factory/renderer.py
This commit is contained in:
commit
7b6e14b715
@ -20,7 +20,6 @@ class Renderer:
|
|||||||
self.clock = pygame.time.Clock()
|
self.clock = pygame.time.Clock()
|
||||||
assets = list((Path(__file__).parent / 'assets').glob('*.png'))
|
assets = list((Path(__file__).parent / 'assets').glob('*.png'))
|
||||||
self.assets = {path.stem: self.load_asset(str(path), 0.95) for path in assets}
|
self.assets = {path.stem: self.load_asset(str(path), 0.95) for path in assets}
|
||||||
print(self.assets)
|
|
||||||
self.fill_bg()
|
self.fill_bg()
|
||||||
|
|
||||||
def fill_bg(self):
|
def fill_bg(self):
|
||||||
@ -48,6 +47,10 @@ class Renderer:
|
|||||||
return wall_img
|
return wall_img
|
||||||
|
|
||||||
def render(self, pos_dict):
|
def render(self, pos_dict):
|
||||||
|
for event in pygame.event.get():
|
||||||
|
if event.type == pygame.QUIT:
|
||||||
|
pygame.quit()
|
||||||
|
sys.exit()
|
||||||
self.fill_bg()
|
self.fill_bg()
|
||||||
for asset, positions in pos_dict.items():
|
for asset, positions in pos_dict.items():
|
||||||
for x, y in positions:
|
for x, y in positions:
|
||||||
@ -63,7 +66,7 @@ class Renderer:
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
renderer = Renderer(fps=2, cell_size=40, assets=['wall', 'agent', 'dirt'])
|
renderer = Renderer(fps=2, cell_size=40)
|
||||||
for i in range(15):
|
for i in range(15):
|
||||||
renderer.render({'agent': [(5, i)], 'wall': [(0, i), (i, 0)], 'dirt': [(3, 3), (3, 4)]})
|
renderer.render({'agent': [(5, i)], 'wall': [(0, i), (i, 0)], 'dirt': [(3,3), (3,4)]})
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user