From b39c20da5f85717e863d51789e3adaff70555fd6 Mon Sep 17 00:00:00 2001 From: Niebby Date: Sun, 28 Mar 2021 15:23:14 +0200 Subject: [PATCH] added sprites and made them render as agents in visualisation --- server.py | 11 ++++------- sprites/box.png | Bin 0 -> 153 bytes sprites/hero.png | Bin 0 -> 221 bytes 3 files changed, 4 insertions(+), 7 deletions(-) create mode 100644 sprites/box.png create mode 100644 sprites/hero.png diff --git a/server.py b/server.py index b3673e3..814ec14 100644 --- a/server.py +++ b/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) diff --git a/sprites/box.png b/sprites/box.png new file mode 100644 index 0000000000000000000000000000000000000000..42785e9ce6ee51119427fc0e2d3211029bbd62a4 GIT binary patch literal 153 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!60wlNoGJgf67>k44ofy`glX(f`1bezThGC|afB^?fy6XS>qBjS(aG5T-{?75BV7XwO!rFJ%V%+;4GI8s;tW}Va5s^^)7P6mT z`Hjq`ul_bhFJshk=e_#Lf*TOfBsh^Lkbtj9g=n=Gk@lWW#BZI-I&MCr2?bf^OJ(C=+=)pLt zsP*vXb}s(7pKe7phyJj7Dnw42xOIMS|I$vmDa^YP4&*)LmfJ2cHKy*yNqq(zt4-c@ zp%+Z^rXJ|-J@(V;)TC!VEI02T46A>4c~z8kr{`0X^8AG?5l(hy>lP@Mr&}=ojgR7b TS9#<#(1{G5u6{1-oD!M<&$U-^ literal 0 HcmV?d00001