Skip to content

Convert tilemap attribute docs to docstrings which produce better autodocs #1785

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 28 additions & 15 deletions arcade/tilemap/tilemap.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import pytiled_parser
import pytiled_parser.tiled_object
from pytiled_parser import Color

from arcade import (
AnimatedTimeBasedSprite,
Expand Down Expand Up @@ -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: 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]
"""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,
Expand Down