completed moving walls to map

This commit is contained in:
Lukas Nöllemeyer 2024-08-17 09:56:13 +02:00
parent 9b85305481
commit 91485c0f6b
4 changed files with 14 additions and 15 deletions

View file

@ -15,7 +15,7 @@ import game.world_tools
from game.components import Gold, Graphic, Position
from game.constants import DIRECTION_KEYS, ACTION_KEYS
from game.state import Push, Reset, State, StateResult
from game.tags import IsItem, IsPlayer, IsWall, IsDoor, IsActor
from game.tags import IsItem, IsPlayer, IsDoor, IsActor
from game.constants import WALL_CHAR
@attrs.define()
@ -34,7 +34,7 @@ class InGame(State):
raise SystemExit()
case tcod.event.KeyDown(sym=sym) if sym in DIRECTION_KEYS:
new_pos = player.components[Position] + DIRECTION_KEYS[sym]
if not g.world_map.walkable[g.world_center[1]+new_pos.y][g.world_center[0]+new_pos.x]:
if not g.world_map.walkable[g.world_center.y+new_pos.y][g.world_center.x+new_pos.x]:
return None
player.components[Position] = new_pos
# Auto pickup gold