fixed last commit

This commit is contained in:
Lukas Nöllemeyer 2024-08-17 20:31:32 +02:00
parent 675e4a6af7
commit 5be7a61e56

View file

@ -99,11 +99,17 @@ class MainScreen(Screen):
console.rgb[["ch", "fg"]][screen_pos.y + h, screen_pos.x + w] = graphic.ch, graphic.fg console.rgb[["ch", "fg"]][screen_pos.y + h, screen_pos.x + w] = graphic.ch, graphic.fg
# Draw walls # Draw walls
doors = [ d.components[Position] for d in g.world.Q.all_of(tags=[IsDoor]) ] doors = [ world_pos_to_map_pos(d.components[Position]) for d in g.world.Q.all_of(tags=[IsDoor]) ]
for (y, row) in enumerate(map.walkable): for (y, row) in enumerate(map.walkable):
for (x, val) in enumerate(row): for (x, val) in enumerate(row):
pos = map_pos_to_world_pos(Position(x,y)) pos = map_pos_to_world_pos(Position(x,y))
graphic = Graphic(0 if val else WALL_CHAR if (map.walkable[y+1,x] and Position(x ,y+1) in doors) else VERTICAL_WALL_CHAR) ch = 0
if not val:
ch = VERTICAL_WALL_CHAR
in_doors = Position(x,y+1) in doors
if map.walkable[y+1,x] and not in_doors:
ch = WALL_CHAR
graphic = Graphic(ch)
draw(pos, graphic) draw(pos, graphic)
# draw all entities that are not actors # draw all entities that are not actors
for entity in g.world.Q.all_of(components=[Position, Graphic]).none_of(tags=[IsActor]): for entity in g.world.Q.all_of(components=[Position, Graphic]).none_of(tags=[IsActor]):