Пример #1
0
 def __init__(self, width, height, dungeon_level=1):
     super(GameMap, self).__init__(width, height)
     # Map Variables
     self.turn_count = 0
     # self.turn_count = TurnCount()
     self.dungeon_level = dungeon_level
     self.spawn_chances = {
         'mobs': {},
         'items': {}
     }  # Used to display dungeon level stats
     self.tile_set = obtain_tile_set()
Пример #2
0
import numpy as np

import tcod
from tcod.map import Map
from tcod.map import compute_fov


from loader_functions.JsonReader import obtain_tile_set


TILE_SET = obtain_tile_set()


def initialize_fov(game_map):
    fov_map = Map(game_map.width, game_map.height)
    for x in range(game_map.width):
        for y in range(game_map.height):
            # TODO: Verify if python 2D matrixes and numpy arrays are the same, but just reversed. :|
            fov_map.transparent[y][x] = game_map.transparent[y][x]
            fov_map.walkable[y][x] = game_map.walkable[y][x]
            fov_map.fov[y][x] = game_map.fov[y][x]
    return fov_map


def recompute_fov(fov_map, player, temporary_vision, light_walls=True, algorithm=0):
    x, y = player.position.x, player.position.y
    radius = player.fighter.fov_range

    # TODO: Enable FOV for an open or closed door
    for _x, _y in temporary_vision:
        fov_map.transparent[_y][_x] = True