tmx_utils.py 334B

1234567891011121314
  1. # coding: utf-8
  2. from tmx import TileMap
  3. from tmx import Layer
  4. from synergine2.exceptions import ConfigurationError
  5. def get_layer_by_name(map_: TileMap, layer_name: str) -> Layer:
  6. for layer in map_.layers:
  7. if layer.name == layer_name:
  8. return layer
  9. raise ConfigurationError('No layer named "{}" in map')