Ejemplo n.º 1
0
    def __init__(self, tile: Tile, map: 'Map', scene: 'GameScene'):
        super().__init__(tile, map, scene)
        self.name = self.NAME
        self.description = self.DESCRIPTION
        self._hp = self.BASE_HP
        self._max_hp = self.BASE_HP
        self._tp = self.BASE_TP
        self._max_tp = self.BASE_TP
        self._xp = 0
        self._bump_damage = 1
        self._range = self.RANGE

        self.frozen = 0
        self.state = ActorState.ALIVE

        # Ephemeral deltas
        self.delta_hp = 0
        self.delta_tp = 0
        self.delta_pos = Point(0, 0)
        self.delta_xp = 0

        self._states = {}
        self._visible_points = get_visible_points(self.position,
                                                  self.map.get_allows_light,
                                                  max_distance=self._range)
Ejemplo n.º 2
0
def draw(tilemap, player_pos):
    los_cache = get_visible_points(player_pos, lambda p: _get_allows_light(tilemap, p))

    for cell in tilemap.cells:
        if cell.point not in los_cache: continue
        if cell.terrain == 0:
            terminal.put(cell.point, '.')
        elif cell.terrain == 1:
            terminal.put(cell.point, '#')
    terminal.put(player_pos, '@')
Ejemplo n.º 3
0
 def update_pos(self):
     self.unblock()
     if self.delta_pos != Point(0, 0):
         self._pos += self.delta_pos
         bearlib.clear(self._pos.x, self._pos.y, 1, 1)
         self._visible_points = get_visible_points(
             self.position,
             self.map.get_allows_light,
             max_distance=self._range)
     self.update_block()
     self.delta_pos = Point(0, 0)
Ejemplo n.º 4
0
 def update_los_cache(self):
   self.los_cache = get_visible_points(self.player.position, self.get_can_see)
   self.level_memory_cache.update(self.los_cache)