コード例 #1
0
def get_names_at_location(x: int, y: int, game_map: GameMap) -> str:
    if not game_map.in_bounds(x, y) or not game_map.visible[x, y]:
        return ''

    names = ', '.join(entity.name for entity in game_map.entities
                      if entity.x == x and entity.y == y)

    return names.capitalize()
コード例 #2
0
def get_names_at_location(x: int, y: int, game_map: GameMap) -> str:
    """ returns the names of any entities at a location
    edit me to return any information you want """
    if not game_map.in_bounds(x, y) or not game_map.visible[x, y]:
        return ""

    names = ", ".join(entity.name for entity in game_map.entities
                      if entity.x == x and entity.y == y)

    return names.capitalize()
コード例 #3
0
def get_names_at_location(x: int, y: int, game_map: GameMap) -> str:
    """Gets the name of entities on the pointed/chosen tile"""
    if not game_map.in_bounds(x, y) or not game_map.visible[x, y]:
        return ""

    names = ", ".join(
        entity.name for entity in game_map.entities if entity.x == x and entity.y == y
    )

    return names.capitalize()
コード例 #4
0
ファイル: test_game_map.py プロジェクト: Niarit/rogue_like
 def test_in_bounds(self):
     player = copy.deepcopy(entity_factories.player)
     engine = Engine(player=player)
     from game_map import GameMap
     game_map = GameMap(engine, 5, 5)
     self.assertFalse(game_map.in_bounds(5, 6))