made walking into doors open them
This commit is contained in:
parent
091ff11b6d
commit
eaa19304e1
1 changed files with 8 additions and 1 deletions
|
|
@ -38,8 +38,15 @@ class MainScreen(Screen):
|
|||
case tcod.event.Quit():
|
||||
raise SystemExit()
|
||||
case tcod.event.KeyDown(sym=sym) if sym in DIRECTION_KEYS:
|
||||
new_pos = player.components[Position] + DIRECTION_KEYS[sym]
|
||||
pos = player.components[Position]
|
||||
new_pos = pos + DIRECTION_KEYS[sym]
|
||||
map_pos = world_pos_to_map_pos(new_pos)
|
||||
if a := g.world.Q.all_of(components=[Action], tags=[new_pos]):
|
||||
for aa in a:
|
||||
aa.components[Action](aa)
|
||||
map_pos = world_pos_to_map_pos(pos)
|
||||
map.compute_fov(map_pos.x, map_pos.y, 100)
|
||||
return None
|
||||
if not map.walkable[map_pos.y, map_pos.x]:
|
||||
return None
|
||||
player.components[Position] = new_pos
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue