From 97bd12de8376cc0e679f72bb8aa4cbd819661130 Mon Sep 17 00:00:00 2001 From: Darren Eberly Date: Sun, 7 Jun 2020 20:21:35 -0400 Subject: [PATCH] removed checking for type attribute as it should always appear in the JSON format. --- pytiled_parser/tiled_object.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pytiled_parser/tiled_object.py b/pytiled_parser/tiled_object.py index 06796ab..fe092af 100644 --- a/pytiled_parser/tiled_object.py +++ b/pytiled_parser/tiled_object.py @@ -201,6 +201,7 @@ def _get_common_attributes(raw_tiled_object: RawTiledObject) -> TiledObject: Returns: TiledObject: The attributes in common of all Tiled Objects """ + common_attributes = TiledObject( id=raw_tiled_object["id"], coordinates=OrderedPair(raw_tiled_object["x"], raw_tiled_object["y"]), @@ -208,11 +209,9 @@ def _get_common_attributes(raw_tiled_object: RawTiledObject) -> TiledObject: size=Size(raw_tiled_object["width"], raw_tiled_object["height"]), rotation=raw_tiled_object["rotation"], name=raw_tiled_object["name"], + type=raw_tiled_object["type"], ) - if raw_tiled_object.get("type") is not None: - common_attributes.type = raw_tiled_object["type"] - if raw_tiled_object.get("properties") is not None: common_attributes.properties = properties_.cast(raw_tiled_object["properties"])