Exemple #1
0
    def compute_fov(self, from_x, from_y):
        """
        Recompute fov based on the (from_x, from_y) position.

        (Typically, (from_y, from_y) will be the player's current position).

        """
        libtcod.map_compute_fov(
            self.fov_map, from_x, from_y, 10, True, 0   # TODO: use constants
        )
        for x, y, cell in self.map:
            if libtcod.map_is_in_fov(self.fov_map, x, y):
                cell.explored = True
Exemple #2
0
def dummy_draw_level(level):
    for x, y, cell in level.map:
        if not cell.explored:
            continue
        in_fov = libtcod.map_is_in_fov(level.fov_map, x, y)
        if in_fov:
            if cell.blocks_sight:
                col = color_light_wall
            else:
                col = color_light_ground
        else:
            if cell.blocks_sight:
                col = color_dark_wall
            else:
                col = color_dark_ground

        libtcod.console_set_char_background(0, x, y, col)
        # libtcod.console_set_char_foreground(0, x, y, col)
        # libtcod.console_set_char(0, x, y, ch)

    for obj in level.objects:
        libtcod.console_set_char(0, obj.x, obj.y, obj.char)