Working visibility and displaying it, still need to hide things that aren't visible

This commit is contained in:
Nicolas Margulies
2020-12-18 17:04:45 +01:00
parent 62ce2b5c71
commit 86628fdea6
4 changed files with 64 additions and 41 deletions

View File

@ -15,8 +15,15 @@ class MapDisplay(Display):
self.pad = self.newpad(m.height, self.pack.tile_width * m.width + 1)
def update_pad(self) -> None:
self.addstr(self.pad, 0, 0, self.map.draw_string(self.pack),
self.pack.tile_fg_color, self.pack.tile_bg_color)
for j in range(len(self.map.tiles)):
for i in range(len(self.map.tiles[j])):
color = self.pack.tile_fg_visible_color if \
self.map.visibility[j][i] else self.pack.tile_fg_color
self.addstr(self.pad, j, self.pack.tile_width * i,
self.map.tiles[j][i].char(self.pack),
color, self.pack.tile_bg_color)
# self.addstr(self.pad, 0, 0, self.map.draw_string(self.pack),
# self.pack.tile_fg_color, self.pack.tile_bg_color)
for e in self.map.entities:
self.addstr(self.pad, e.y, self.pack.tile_width * e.x,
self.pack[e.name.upper()],