From 271c1ae8e5b3cc3c40b83f580bfc464cac263192 Mon Sep 17 00:00:00 2001 From: cspotcode Date: Wed, 17 May 2023 21:09:06 -0400 Subject: [PATCH 1/2] WIP --- arcade/tilemap/tilemap.py | 43 +++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/arcade/tilemap/tilemap.py b/arcade/tilemap/tilemap.py index 9d86e2708b..98b7499401 100644 --- a/arcade/tilemap/tilemap.py +++ b/arcade/tilemap/tilemap.py @@ -16,6 +16,7 @@ import pytiled_parser import pytiled_parser.tiled_object +from pytiled_parser import Color from arcade import ( AnimatedTimeBasedSprite, @@ -156,23 +157,35 @@ class TileMap: The keys and their values in each layer are passed to the layer processing functions using the `**` operator on the dictionary. + """ - - Attributes: - :tiled_map: The pytiled-parser map object. This can be useful for implementing features - that aren't supported by this class by accessing the raw map data directly. - :width: The width of the map in tiles. This is the number of tiles, not pixels. - :height: The height of the map in tiles. This is the number of tiles, not pixels. - :tile_width: The width in pixels of each tile. - :tile_height: The height in pixels of each tile. - :background_color: The background color of the map. - :scaling: A global scaling value to be applied to all Sprites in the map. - :sprite_lists: A dictionary mapping SpriteLists to their layer names. This is used - for all tile layers of the map. - :object_lists: A dictionary mapping TiledObjects to their layer names. This is used - for all object layers of the map. - :offset: A tuple containing the X and Y position offset values. + tiled_map: pytiled_parser.TiledMap + """ + The pytiled-parser map object. This can be useful for implementing features + that aren't supported by this class by accessing the raw map data directly. + """ + width: float + "The width of the map in tiles. This is the number of tiles, not pixels." + height: float + "The height of the map in tiles. This is the number of tiles, not pixels." + tile_width: float + "The width in pixels of each tile." + tile_height: float + "The height in pixels of each tile." + background_color: Color | None + "The background color of the map." + scaling: float + "A global scaling value to be applied to all Sprites in the map." + sprite_lists: dict[str, SpriteList] + """A dictionary mapping SpriteLists to their layer names. This is used + for all tile layers of the map.""" + object_lists: dict[str, list[TiledObject]] + """ + A dictionary mapping TiledObjects to their layer names. This is used + for all object layers of the map. """ + offset: Vec2 + "A tuple containing the X and Y position offset values." def __init__( self, From 66bcb23ed20751c1370a9c4cfad21a70396403c8 Mon Sep 17 00:00:00 2001 From: cspotcode Date: Wed, 17 May 2023 22:03:25 -0400 Subject: [PATCH 2/2] fix lint failures --- arcade/tilemap/tilemap.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arcade/tilemap/tilemap.py b/arcade/tilemap/tilemap.py index 98b7499401..f5cc88b5fd 100644 --- a/arcade/tilemap/tilemap.py +++ b/arcade/tilemap/tilemap.py @@ -172,14 +172,14 @@ class TileMap: "The width in pixels of each tile." tile_height: float "The height in pixels of each tile." - background_color: Color | None + background_color: Optional[Color] "The background color of the map." scaling: float "A global scaling value to be applied to all Sprites in the map." - sprite_lists: dict[str, SpriteList] + sprite_lists: Dict[str, SpriteList] """A dictionary mapping SpriteLists to their layer names. This is used for all tile layers of the map.""" - object_lists: dict[str, list[TiledObject]] + object_lists: Dict[str, List[TiledObject]] """ A dictionary mapping TiledObjects to their layer names. This is used for all object layers of the map.