Working visibility (at least relatively good), but a few lines untested

This commit is contained in:
Nicolas Margulies
2020-12-18 21:21:00 +01:00
parent 86628fdea6
commit 762bed888a
6 changed files with 77 additions and 7 deletions

View File

@ -17,6 +17,8 @@ class MapDisplay(Display):
def update_pad(self) -> None:
for j in range(len(self.map.tiles)):
for i in range(len(self.map.tiles[j])):
if not self.map.seen_tiles[j][i]:
continue
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,
@ -25,9 +27,11 @@ class MapDisplay(Display):
# 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()],
self.pack.entity_fg_color, self.pack.entity_bg_color)
if self.map.visibility[e.y][e.x]:
self.addstr(self.pad, e.y, self.pack.tile_width * e.x,
self.pack[e.name.upper()],
self.pack.entity_fg_color,
self.pack.entity_bg_color)
# Display Path map for debug purposes
# from squirrelbattle.entities.player import Player