completed moving walls to map
This commit is contained in:
parent
9b85305481
commit
91485c0f6b
4 changed files with 14 additions and 15 deletions
|
|
@ -10,17 +10,18 @@ from tcod.ecs import Registry, Entity
|
|||
from tcod.map import Map
|
||||
|
||||
from game.components import Gold, Graphic, Position
|
||||
from game.tags import IsActor, IsItem, IsPlayer, IsWall, IsDoor
|
||||
from game.tags import IsActor, IsItem, IsPlayer, IsDoor
|
||||
|
||||
def add_wall(x, y, remove=False):
|
||||
g.world_map.walkable[50+y][50+x] = remove
|
||||
def add_wall(pos, remove=False):
|
||||
r_pos = g.world_center + pos
|
||||
g.world_map.walkable[r_pos.y][r_pos.x] = remove
|
||||
|
||||
def add_door(x, y):
|
||||
def add_door(pos):
|
||||
door = g.world[object()]
|
||||
door.tags.add(IsDoor)
|
||||
door.components[Position] = Position(x,y)
|
||||
door.components[Position] = pos
|
||||
door.components[Graphic] = Graphic(ord("\\"))
|
||||
add_wall(x,y)
|
||||
add_wall(pos)
|
||||
|
||||
|
||||
def new_world() -> Registry:
|
||||
|
|
@ -46,9 +47,9 @@ def new_world() -> Registry:
|
|||
|
||||
for i in range(20):
|
||||
if i == 5 or i == 9:
|
||||
add_door(10,i)
|
||||
add_door(Position(10,i))
|
||||
else:
|
||||
add_wall(10, i)
|
||||
add_wall(Position(10, i))
|
||||
|
||||
return world
|
||||
|
||||
|
|
@ -57,4 +58,4 @@ def unlock_door(door: Entity):
|
|||
door.components[Graphic] = Graphic(ord("_"))
|
||||
door.tags.clear()
|
||||
pos = door.components[Position]
|
||||
add_wall(pos.x,pos.y, remove=True)
|
||||
add_wall(pos, remove=True)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue