Ejemplo n.º 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()
Ejemplo n.º 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()
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()
Ejemplo n.º 4
0
 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))