added sprites and made them render as agents in visualisation
This commit is contained in:
parent
020b1aa6a1
commit
b39c20da5f
11
server.py
11
server.py
@ -4,14 +4,11 @@ from mesa.visualization.ModularVisualization import ModularServer
|
||||
|
||||
|
||||
def player_representation(agent):
|
||||
portrayal = {"Shape": "circle",
|
||||
"Filled": "true",
|
||||
"Layer": 0,
|
||||
"Color": "red",
|
||||
"r": 0.5}
|
||||
portrayal = {"Shape": "sprites/hero.png",
|
||||
"Layer": 1}
|
||||
if agent.isBox:
|
||||
portrayal["Color"] = "grey"
|
||||
portrayal["Layer"] = 1
|
||||
portrayal["Shape"] = "sprites/box.png"
|
||||
portrayal["Layer"] = 0
|
||||
return portrayal
|
||||
|
||||
grid = CanvasGrid(player_representation, 10, 10, 500, 500)
|
||||
|
BIN
sprites/box.png
Normal file
BIN
sprites/box.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 153 B |
BIN
sprites/hero.png
Normal file
BIN
sprites/hero.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 221 B |
Loading…
Reference in New Issue
Block a user