From a82ae5e45b341efd3360387d14ad4003d02009b0 Mon Sep 17 00:00:00 2001 From: Benjamin Kirkbride Date: Sun, 31 May 2020 01:11:06 -0400 Subject: [PATCH 1/2] tests: s/TILE_IMAGES/TILES --- tests/test_tiled_object.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_tiled_object.py b/tests/test_tiled_object.py index f0d5fda..a36636b 100644 --- a/tests/test_tiled_object.py +++ b/tests/test_tiled_object.py @@ -322,7 +322,7 @@ POINTS = [ ), ] -TILE_IMAGES = [ +TILES = [ ( """ { @@ -1053,7 +1053,7 @@ TEXTS = [ ), ] -OBJECTS = ELLIPSES + RECTANGLES + POINTS + TILE_IMAGES + POLYGONS + POLYLINES + TEXTS +OBJECTS = ELLIPSES + RECTANGLES + POINTS + TILES + POLYGONS + POLYLINES + TEXTS @pytest.mark.parametrize("raw_object_json,expected", OBJECTS) From 77d67425144538d64092ef93c9fc28fff387f3b0 Mon Sep 17 00:00:00 2001 From: Benjamin Kirkbride Date: Sun, 31 May 2020 01:13:07 -0400 Subject: [PATCH 2/2] add: Tile caster --- pytiled_parser/tiled_object.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pytiled_parser/tiled_object.py b/pytiled_parser/tiled_object.py index d4d72e5..6d864e1 100644 --- a/pytiled_parser/tiled_object.py +++ b/pytiled_parser/tiled_object.py @@ -268,7 +268,9 @@ def _cast_point(raw_tiled_object: RawTiledObject) -> Point: def _cast_tile(raw_tiled_object: RawTiledObject) -> Tile: - raise NotImplementedError + gid = raw_tiled_object["gid"] + + return Tile(gid=gid, **_get_common_attributes(raw_tiled_object).__dict__) def _cast_polygon(raw_tiled_object: RawTiledObject) -> Polygon: