mirror of
https://github.com/OMGeeky/pytiled_parser.git
synced 2025-12-26 17:02:28 +01:00
Add support for GID to a tiled object.
This commit is contained in:
@@ -250,6 +250,7 @@ class _TiledObjectBase:
|
||||
|
||||
@dataclasses.dataclass
|
||||
class _TiledObjectDefaults:
|
||||
gid: int = None
|
||||
size: Size = Size(0, 0)
|
||||
rotation: int = 0
|
||||
opacity: float = 1
|
||||
|
||||
@@ -251,6 +251,11 @@ def _parse_objects(
|
||||
|
||||
tiled_object = objects.TiledObject(id_, location)
|
||||
|
||||
try:
|
||||
tiled_object.gid = int(object_element.attrib["gid"])
|
||||
except KeyError:
|
||||
tiled_object.gid = None
|
||||
|
||||
try:
|
||||
width = float(object_element.attrib["width"])
|
||||
except KeyError:
|
||||
|
||||
Reference in New Issue
Block a user