dynamic wall drawing
This commit is contained in:
parent
2fae90e071
commit
866c2c14de
4 changed files with 9 additions and 6 deletions
|
|
@ -41,4 +41,5 @@ ACTION_KEYS: Final = {
|
|||
|
||||
}
|
||||
|
||||
WALL_CHAR: Final = ord('#')
|
||||
WALL_CHAR: Final = ord('_')
|
||||
VERTICAL_WALL_CHAR: Final = ord('|')
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ from game.components import Action, Gold, Graphic, Position
|
|||
from game.constants import DIRECTION_KEYS, ACTION_KEYS
|
||||
from game.screens import Push, Screen, ScreenResult
|
||||
from game.tags import IsItem, IsPlayer, IsActor
|
||||
from game.constants import WALL_CHAR
|
||||
from game.constants import WALL_CHAR, VERTICAL_WALL_CHAR
|
||||
from game.screens import menu_screens
|
||||
from game.world_tools import world_pos_to_map_pos, map_pos_to_world_pos
|
||||
|
||||
|
|
@ -94,7 +94,9 @@ class MainScreen(Screen):
|
|||
for (y, row) in enumerate(map.walkable):
|
||||
for (x, val) in enumerate(row):
|
||||
pos = map_pos_to_world_pos(Position(x,y))
|
||||
draw(pos, Graphic(0) if val else Graphic(WALL_CHAR))
|
||||
graphic = Graphic(0) if val else\
|
||||
Graphic(WALL_CHAR) if map.walkable[y+1,x] else Graphic(VERTICAL_WALL_CHAR)
|
||||
draw(pos, graphic)
|
||||
# draw all entities that are not actors
|
||||
for entity in g.world.Q.all_of(components=[Position, Graphic]).none_of(tags=[IsActor]):
|
||||
draw(entity.components[Position], entity.components[Graphic])
|
||||
|
|
|
|||
|
|
@ -83,6 +83,6 @@ def new_world() -> Registry:
|
|||
|
||||
|
||||
def unlock_door(door: Entity):
|
||||
door.components[Graphic] = Graphic(ord("_"))
|
||||
door.components[Graphic] = Graphic(ord("/"))
|
||||
door.components.pop(Action)
|
||||
add_wall(g.world, door.components[Position], remove=True)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue