enhanced FOV

This commit is contained in:
Lukas Nöllemeyer 2024-08-17 12:28:39 +02:00
parent 0a0ff2d1ed
commit 1bd0ab372d
4 changed files with 20 additions and 15 deletions

View file

@ -1,25 +1,27 @@
"""Functions for working with worlds."""
from __future__ import annotations
from random import Random
import g
from typing import Final
from tcod.ecs import Registry, Entity
from tcod.map import Map
import g
from game.components import Gold, Graphic, Position
from game.tags import IsActor, IsItem, IsPlayer, IsDoor
world_center: Final = Position(50, 50)
def world_pos_to_map_pos(pos):
return pos+g.world_center
return pos+world_center
def map_pos_to_world_pos(pos):
return pos-g.world_center
return pos-world_center
def add_wall(world, pos, remove=False):
r_pos = g.world_center + pos
r_pos = world_pos_to_map_pos(pos)
map = world[None].components[Map]
map.walkable[r_pos.y][r_pos.x] = remove
map.transparent[r_pos.y][r_pos.x] = remove