mirror of
https://github.com/OMGeeky/pytiled_parser.git
synced 2025-12-26 17:02:28 +01:00
API Reference docs update
This commit is contained in:
@@ -8,17 +8,17 @@ to get the same values, or you can reference them by name. The values shown here
|
||||
will be in the final tuple.
|
||||
|
||||
|
||||
pytiled_parser.Color
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
Color
|
||||
^^^^^
|
||||
|
||||
.. autoclass:: pytiled_parser.Color
|
||||
.. autoclass:: pytiled_parser.common_types.Color
|
||||
|
||||
pytiled_parser.OrderedPair
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
OrderedPair
|
||||
^^^^^^^^^^^
|
||||
|
||||
.. autoclass:: pytiled_parser.OrderedPair
|
||||
.. autoclass:: pytiled_parser.common_types.OrderedPair
|
||||
|
||||
pytiled_parser.Size
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
Size
|
||||
^^^^
|
||||
|
||||
.. autoclass:: pytiled_parser.Size
|
||||
.. autoclass:: pytiled_parser.common_types.Size
|
||||
@@ -15,6 +15,12 @@ cover some of the concepts surrounding that module and it's usage within Tiled.
|
||||
:maxdepth: 1
|
||||
:caption: PyTiled Parser
|
||||
|
||||
parser
|
||||
common_types
|
||||
properties
|
||||
tileset
|
||||
layer
|
||||
objects
|
||||
map
|
||||
wang_set
|
||||
world
|
||||
|
||||
@@ -11,38 +11,38 @@ and serves only as an abstract base for common elements between all types.
|
||||
For more information about Layers, see `Tiled's Manual <https://doc.mapeditor.org/en/stable/manual/layers/>`_
|
||||
|
||||
|
||||
pytiled_parser.Layer
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
Layer
|
||||
^^^^^
|
||||
|
||||
.. autoclass:: pytiled_parser.Layer
|
||||
.. autoclass:: pytiled_parser.layer.Layer
|
||||
:members:
|
||||
|
||||
pytiled_parser.TileLayer
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
TileLayer
|
||||
^^^^^^^^^
|
||||
|
||||
.. autoclass:: pytiled_parser.TileLayer
|
||||
.. autoclass:: pytiled_parser.layer.TileLayer
|
||||
:members:
|
||||
|
||||
pytiled_parser.Chunk
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
Chunk
|
||||
^^^^^
|
||||
|
||||
.. autoclass:: pytiled_parser.Chunk
|
||||
.. autoclass:: pytiled_parser.layer.Chunk
|
||||
:members:
|
||||
|
||||
pytiled_parser.ObjectLayer
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
ObjectLayer
|
||||
^^^^^^^^^^^
|
||||
|
||||
.. autoclass:: pytiled_parser.ObjectLayer
|
||||
.. autoclass:: pytiled_parser.layer.ObjectLayer
|
||||
:members:
|
||||
|
||||
pytiled_parser.ImageLayer
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
ImageLayer
|
||||
^^^^^^^^^^
|
||||
|
||||
.. autoclass:: pytiled_parser.ImageLayer
|
||||
.. autoclass:: pytiled_parser.layer.ImageLayer
|
||||
:members:
|
||||
|
||||
pytiled_parser.LayerGroup
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LayerGroup
|
||||
^^^^^^^^^^
|
||||
|
||||
.. autoclass:: pytiled_parser.LayerGroup
|
||||
.. autoclass:: pytiled_parser.layer.LayerGroup
|
||||
:members:
|
||||
10
docs/api/map.rst
Normal file
10
docs/api/map.rst
Normal file
@@ -0,0 +1,10 @@
|
||||
.. _map_api:
|
||||
Map
|
||||
===
|
||||
|
||||
This module provides the primary TiledMap class which represents a single map from Tiled.
|
||||
|
||||
TiledMap
|
||||
^^^^^^^^
|
||||
|
||||
.. autoclass:: pytiled_parser.tiled_map.TiledMap
|
||||
59
docs/api/objects.rst
Normal file
59
docs/api/objects.rst
Normal file
@@ -0,0 +1,59 @@
|
||||
.. _objects_api:
|
||||
Objects
|
||||
=======
|
||||
|
||||
This module provides classes for all of the Tiled Object types.
|
||||
|
||||
There is the base TiledObject class, which all of the actual object types inherit from.
|
||||
The base TiledObject class is never directly used, and serves only as an abstract base
|
||||
for common elements between all types.
|
||||
|
||||
Some objects have no extra attributes over the base class, they exist as different classes anyways
|
||||
to denote the type of object, so that an implementation can load it in accordingly. For example, an
|
||||
Ellipse and a Point have no differing attributes from the base class, but obviously need to be handled
|
||||
very differently.
|
||||
|
||||
For more information about objects, see `Tiled's Manual <https://doc.mapeditor.org/en/stable/manual/objects/>`_
|
||||
|
||||
Also see the `TMX Reference <https://doc.mapeditor.org/en/stable/reference/tmx-map-format/#object>`_
|
||||
and `JSON Reference <https://doc.mapeditor.org/en/stable/reference/json-map-format/#object>`_
|
||||
|
||||
TiledObject
|
||||
^^^^^^^^^^^
|
||||
|
||||
.. autoclass:: pytiled_parser.tiled_object.TiledObject
|
||||
|
||||
Ellipse
|
||||
^^^^^^^
|
||||
|
||||
.. autoclass:: pytiled_parser.tiled_object.Ellipse
|
||||
|
||||
Point
|
||||
^^^^^
|
||||
|
||||
.. autoclass:: pytiled_parser.tiled_object.Point
|
||||
|
||||
Polygon
|
||||
^^^^^^^
|
||||
|
||||
.. autoclass:: pytiled_parser.tiled_object.Polygon
|
||||
|
||||
Polyline
|
||||
^^^^^^^^
|
||||
|
||||
.. autoclass:: pytiled_parser.tiled_object.Polyline
|
||||
|
||||
Rectangle
|
||||
^^^^^^^^^
|
||||
|
||||
.. autoclass:: pytiled_parser.tiled_object.Rectangle
|
||||
|
||||
Text
|
||||
^^^^
|
||||
|
||||
.. autoclass:: pytiled_parser.tiled_object.Text
|
||||
|
||||
Tile
|
||||
^^^^
|
||||
|
||||
.. autoclass:: pytiled_parser.tiled_object.Tile
|
||||
17
docs/api/parser.rst
Normal file
17
docs/api/parser.rst
Normal file
@@ -0,0 +1,17 @@
|
||||
.. _parser_api:
|
||||
Parser
|
||||
======
|
||||
|
||||
This module exposes the actual parsing functions. If you are creating an implementation, this is
|
||||
what you will actually pass a file to and receive back a PyTiled Parser Map or World class depending
|
||||
on what you're parsing.
|
||||
|
||||
pytiled_parser.parse_map
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. autofunction:: pytiled_parser.parse_map
|
||||
|
||||
pytiled_parser.parse_world
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. autofunction:: pytiled_parser.parse_world
|
||||
34
docs/api/tileset.rst
Normal file
34
docs/api/tileset.rst
Normal file
@@ -0,0 +1,34 @@
|
||||
.. _tileset_api:
|
||||
Tileset
|
||||
=======
|
||||
|
||||
This module provides an interface for Tilesets and the various objects they contain.
|
||||
|
||||
Also see `Tiled's Docs for Editing Tilesets <https://doc.mapeditor.org/en/stable/manual/editing-tilesets/>`_
|
||||
and the `TMX Reference <https://doc.mapeditor.org/en/stable/reference/tmx-map-format/#tileset>`_
|
||||
and `JSON Reference <https://doc.mapeditor.org/en/stable/reference/json-map-format/#tileset>`_
|
||||
|
||||
Tileset
|
||||
^^^^^^^
|
||||
|
||||
.. autoclass:: pytiled_parser.tileset.Tileset
|
||||
|
||||
Tile
|
||||
^^^^
|
||||
|
||||
.. autoclass:: pytiled_parser.tileset.Tile
|
||||
|
||||
Transformations
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
.. autoclass:: pytiled_parser.tileset.Transformations
|
||||
|
||||
Frame
|
||||
^^^^^
|
||||
|
||||
.. autoclass:: pytiled_parser.tileset.Frame
|
||||
|
||||
Grid
|
||||
^^^^
|
||||
|
||||
.. autoclass:: pytiled_parser.tileset.Grid
|
||||
28
docs/api/wang_set.rst
Normal file
28
docs/api/wang_set.rst
Normal file
@@ -0,0 +1,28 @@
|
||||
.. _wang_set_api:
|
||||
Wang Set
|
||||
========
|
||||
|
||||
This module contains a number of classes related to Wang Sets.
|
||||
|
||||
Wang Sets are the underlying data used by Tiled's terrain system. It is unlikely this module will
|
||||
ever need touched for creating an implementation in a game engine. It is primarily data used by the
|
||||
editor during map creation.
|
||||
|
||||
See `Tiled's docs about terrain <https://doc.mapeditor.org/en/stable/manual/terrain/>`_
|
||||
and also the `TMX Reference <https://doc.mapeditor.org/en/stable/reference/tmx-map-format/#wangsets>`_
|
||||
and the `JSON Reference <https://doc.mapeditor.org/en/stable/reference/json-map-format/#wang-set>`_
|
||||
|
||||
WangSet
|
||||
^^^^^^^
|
||||
|
||||
.. autoclass:: pytiled_parser.wang_set.WangSet
|
||||
|
||||
WangColor
|
||||
^^^^^^^^^
|
||||
|
||||
.. autoclass:: pytiled_parser.wang_set.WangColor
|
||||
|
||||
WangTile
|
||||
^^^^^^^^
|
||||
|
||||
.. autoclass:: pytiled_parser.wang_set.WangTile
|
||||
23
docs/api/world.rst
Normal file
23
docs/api/world.rst
Normal file
@@ -0,0 +1,23 @@
|
||||
.. _world_api:
|
||||
World
|
||||
=====
|
||||
|
||||
This module provides an implementation for the World files from Tiled.
|
||||
|
||||
See `Tiled's docs for Worlds <https://doc.mapeditor.org/en/stable/manual/worlds/>`_
|
||||
for more info about worlds and what they do.
|
||||
|
||||
The functionality within PyTiled Parser is to load the world and outline the size
|
||||
and position of each map, and provide the path to the map file. Loading a world
|
||||
does not automatically load each map within the world, this is so that the game
|
||||
or engine implementation can decide how to handle map loading.
|
||||
|
||||
WorldMap
|
||||
^^^^^^^^
|
||||
|
||||
.. autoclass:: pytiled_parser.world.WorldMap
|
||||
|
||||
World
|
||||
^^^^^
|
||||
|
||||
.. autoclass:: pytiled_parser.world.World
|
||||
@@ -14,8 +14,9 @@ PyTiled Parser is not tied to any particular graphics library or game engine.
|
||||
from .common_types import Color, OrderedPair, Size
|
||||
from .exception import UnknownFormat
|
||||
from .layer import Chunk, ImageLayer, Layer, LayerGroup, ObjectLayer, TileLayer
|
||||
from .parser import parse_map
|
||||
from .parser import parse_map, parse_world
|
||||
from .properties import Properties, Property
|
||||
from .tiled_map import TiledMap
|
||||
from .tileset import Tile, Tileset
|
||||
from .tileset import Frame, Grid, Tile, Tileset, Transformations
|
||||
from .version import __version__
|
||||
from .world import World, WorldMap
|
||||
|
||||
@@ -8,10 +8,11 @@ from typing import NamedTuple
|
||||
class Color(NamedTuple):
|
||||
"""Represents an RGBA color value as a four value Tuple.
|
||||
|
||||
:param int red: Red value, between 0 and 255.
|
||||
:param int green: Green value, between 0 and 255.
|
||||
:param int blue: Blue value, between 0 and 255.
|
||||
:param int alpha: Alpha value, between 0 and 255.
|
||||
Attributes:
|
||||
red: Red value, between 0 and 255.
|
||||
green: Green value, between 0 and 255.
|
||||
blue: Blue value, between 0 and 255.
|
||||
alpha: Alpha value, between 0 and 255.
|
||||
"""
|
||||
red: int
|
||||
green: int
|
||||
@@ -22,8 +23,9 @@ class Color(NamedTuple):
|
||||
class Size(NamedTuple):
|
||||
"""Represents a two dimensional size as a two value Tuple.
|
||||
|
||||
:param int width: The width of the object. Can be in either pixels or number of tiles.
|
||||
:param int height: The height of the object. Can be in either pixels or number of tiles.
|
||||
Attributes:
|
||||
width: The width of the object. Can be in either pixels or number of tiles.
|
||||
height: The height of the object. Can be in either pixels or number of tiles.
|
||||
"""
|
||||
|
||||
width: float
|
||||
@@ -33,8 +35,9 @@ class Size(NamedTuple):
|
||||
class OrderedPair(NamedTuple):
|
||||
"""Represents a two dimensional position as a two value Tuple.
|
||||
|
||||
:param int x: X coordinate. Can be in either pixels or number of tiles.
|
||||
:param int y: Y coordinate. Can be in either pixels or number of tiles.
|
||||
Attributes:
|
||||
x: X coordinate. Can be in either pixels or number of tiles.
|
||||
y: Y coordinate. Can be in either pixels or number of tiles.
|
||||
"""
|
||||
|
||||
x: float
|
||||
|
||||
@@ -29,19 +29,20 @@ class Layer:
|
||||
|
||||
`JSON Reference <https://doc.mapeditor.org/en/stable/reference/json-map-format/#layer>`_
|
||||
|
||||
:param str name: The name of the layer object.
|
||||
:param float opacity: Decimal value between 0 and 1 to determine opacity. 1 is completely
|
||||
opaque, 0 is completely transparent. Defaults to 1.
|
||||
:param bool visible: If the layer is visible in the Tiled Editor. Defaults to True
|
||||
:param OrderedPair coordinates: Where layer content starts in tiles. Only used by infinite maps.
|
||||
Defaults to (0, 0).
|
||||
:param OrderedPair parallax_factor: Used to determine parallaxing speed of a layer. Defaults to (1, 1).
|
||||
:param OrderedPair offset: Rendering offset of the layer object in pixels. Defaults to (0, 0).
|
||||
:param Optional[int] id: Unique ID of the layer. Each layer that is added to a map gets a unique id.
|
||||
Even if a layer is deleted, no layer ever gets the same ID.
|
||||
:param Optional[Size] size: Ordered pair of size of map in tiles.
|
||||
:param Optional[Properties] properties: Properties for the layer.
|
||||
:param Optional[Color] tint_color: Tint color that is multiplied with any graphics in this layer.
|
||||
Attributes:
|
||||
name: The name of the layer object.
|
||||
opacity: Decimal value between 0 and 1 to determine opacity. 1 is completely
|
||||
opaque, 0 is completely transparent. Defaults to 1.
|
||||
visible: If the layer is visible in the Tiled Editor. Defaults to True
|
||||
coordinates: Where layer content starts in tiles. Only used by infinite maps.
|
||||
Defaults to (0, 0).
|
||||
parallax_factor: Used to determine parallaxing speed of a layer. Defaults to (1, 1).
|
||||
offset: Rendering offset of the layer object in pixels. Defaults to (0, 0).
|
||||
id: Unique ID of the layer. Each layer that is added to a map gets a unique id.
|
||||
Even if a layer is deleted, no layer ever gets the same ID.
|
||||
size: Ordered pair of size of map in tiles.
|
||||
properties: Properties for the layer.
|
||||
tint_color: Tint color that is multiplied with any graphics in this layer.
|
||||
"""
|
||||
|
||||
name: str
|
||||
@@ -72,9 +73,10 @@ class Chunk:
|
||||
|
||||
`JSON Reference <https://doc.mapeditor.org/en/stable/reference/json-map-format/#chunk>`_
|
||||
|
||||
:param OrderedPair coordinates: Location of chunk in tiles.
|
||||
:param Size size: The size of the chunk in tiles.
|
||||
:param List[List[int]] data: The global tile IDs in the chunk. A row-first two dimensional array.
|
||||
Attributes:
|
||||
coordinates: Location of chunk in tiles.
|
||||
size: The size of the chunk in tiles.
|
||||
data: The global tile IDs in the chunk. A row-first two dimensional array.
|
||||
"""
|
||||
|
||||
coordinates: OrderedPair
|
||||
@@ -99,8 +101,9 @@ class TileLayer(Layer):
|
||||
|
||||
`JSON Reference <https://doc.mapeditor.org/en/stable/reference/json-map-format/#tile-layer-example>`_
|
||||
|
||||
:param Optional[List[Chunk]] chunks: List of chunks (only populated for infinite maps)
|
||||
:param Optional[List[List[int]] data: A two dimensional array of integers representing the global
|
||||
Attributes:
|
||||
chunks: List of chunks (only populated for infinite maps)
|
||||
data: A two dimensional array of integers representing the global
|
||||
tile IDs for the layer (only populaed for non-infinite maps)
|
||||
"""
|
||||
|
||||
@@ -118,12 +121,13 @@ class ObjectLayer(Layer):
|
||||
|
||||
`JSON Reference <https://doc.mapeditor.org/en/stable/reference/json-map-format/#object-layer-example>`_
|
||||
|
||||
:param List[TiledOjbect] tiled_objects: List of tiled_objects in the layer.
|
||||
:param Optional[str] draworder: Whether the objects are drawn according to the order of the object
|
||||
elements in the object group element ('manual'), or sorted by their
|
||||
y-coordinate ('topdown'). Defaults to 'topdown'. See:
|
||||
https://doc.mapeditor.org/en/stable/manual/objects/#changing-stacking-order
|
||||
for more info.
|
||||
Attributes:
|
||||
tiled_objects: List of tiled_objects in the layer.
|
||||
draworder: Whether the objects are drawn according to the order of the object
|
||||
elements in the object group element ('manual'), or sorted by their
|
||||
y-coordinate ('topdown'). Defaults to 'topdown'. See:
|
||||
https://doc.mapeditor.org/en/stable/manual/objects/#changing-stacking-order
|
||||
for more info.
|
||||
"""
|
||||
|
||||
tiled_objects: List[TiledObject]
|
||||
@@ -141,8 +145,9 @@ class ImageLayer(Layer):
|
||||
|
||||
`JSON Reference <https://doc.mapeditor.org/en/stable/reference/json-map-format/#layer>`_
|
||||
|
||||
:param Path image: The image used by this layer.
|
||||
:param Optional[Color] transparent_color: Color that is to be made transparent on this layer.
|
||||
Attributes:
|
||||
image: The image used by this layer.
|
||||
transparent_color: Color that is to be made transparent on this layer.
|
||||
"""
|
||||
|
||||
image: Path
|
||||
@@ -163,7 +168,8 @@ class LayerGroup(Layer):
|
||||
|
||||
`JSON Reference <https://doc.mapeditor.org/en/stable/reference/json-map-format/#layer>`_
|
||||
|
||||
:param Optional[List[Layer]] layers: list of layers contained in the group.
|
||||
Attributes:
|
||||
layers: list of layers contained in the group.
|
||||
"""
|
||||
|
||||
layers: Optional[List[Layer]]
|
||||
|
||||
@@ -5,6 +5,8 @@ from pytiled_parser.parsers.json.tiled_map import parse as json_map_parse
|
||||
from pytiled_parser.parsers.tmx.tiled_map import parse as tmx_map_parse
|
||||
from pytiled_parser.tiled_map import TiledMap
|
||||
from pytiled_parser.util import check_format
|
||||
from pytiled_parser.world import World
|
||||
from pytiled_parser.world import parse_world as _parse_world
|
||||
|
||||
|
||||
def parse_map(file: Path) -> TiledMap:
|
||||
@@ -14,7 +16,7 @@ def parse_map(file: Path) -> TiledMap:
|
||||
file: Path to the map file
|
||||
|
||||
Returns:
|
||||
TiledMap: a properly typed TiledMap
|
||||
TiledMap: A parsed and typed TiledMap
|
||||
"""
|
||||
parser = check_format(file)
|
||||
|
||||
@@ -29,3 +31,14 @@ def parse_map(file: Path) -> TiledMap:
|
||||
"Unknown Map Format, please use either the TMX or JSON format. "
|
||||
"This message could also mean your map file is invalid or corrupted."
|
||||
)
|
||||
|
||||
def parse_world(file: Path) -> World:
|
||||
"""Parse the raw world file into a pytiled_parser type
|
||||
|
||||
Args:
|
||||
file: Path to the world file
|
||||
|
||||
Returns:
|
||||
World: A parsed and typed World
|
||||
"""
|
||||
return _parse_world(file)
|
||||
|
||||
@@ -23,9 +23,9 @@ class TiledMap:
|
||||
as well as all Tiesets used by the map. When creating an implementation, this will
|
||||
be the primary class to work with to pull all data relating to a map.
|
||||
|
||||
[TMX Reference](https://doc.mapeditor.org/en/stable/reference/tmx-map-format/#map)
|
||||
`TMX Reference <https://doc.mapeditor.org/en/stable/reference/tmx-map-format/#map>`_
|
||||
|
||||
[JSON Reference](https://doc.mapeditor.org/en/stable/reference/json-map-format/#map)
|
||||
`JSON Reference <https://doc.mapeditor.org/en/stable/reference/json-map-format/#map>`_
|
||||
|
||||
Attributes:
|
||||
infinite: If the map is infinite or not.
|
||||
@@ -37,9 +37,9 @@ class TiledMap:
|
||||
"staggered" and "hexagonal"
|
||||
render_order: The order in which tiles on tile layers are rendered. Valid values
|
||||
are right-down, right-up, left-down and left-up. In all cases, the map is
|
||||
drawn row-by-row. (only supported for orthogonal maps at the moment)
|
||||
tiled_version: The Tiled version used to save the file. May be a date (for
|
||||
snapshot builds).
|
||||
drawn row-by-row. (only supported for orthogonal maps at the moment)
|
||||
tile_size: The size of a tile.
|
||||
tilesets: Dict of Tileset where Key is the firstgid and the value is the Tileset
|
||||
version: The JSON format version.
|
||||
|
||||
@@ -65,7 +65,7 @@ class Polygon(TiledObject):
|
||||
See: https://doc.mapeditor.org/en/stable/reference/tmx-map-format/#polygon
|
||||
|
||||
Attributes:
|
||||
points: FIXME
|
||||
points: List of coordinates relative to the location of the object.
|
||||
"""
|
||||
|
||||
points: List[OrderedPair]
|
||||
@@ -103,18 +103,19 @@ class Text(TiledObject):
|
||||
and https://doc.mapeditor.org/en/stable/manual/objects/#insert-text
|
||||
|
||||
Attributes:
|
||||
text: The text to display
|
||||
color: Color of the text. (default: (255, 255, 255, 255))
|
||||
font_family: The font family used (default: "sans-serif")
|
||||
font_size: The size of the font in pixels. (default: 16)
|
||||
wrap: Whether word wrapping is enabled. (default: False)
|
||||
color: Color of the text. (default: #000000)
|
||||
bold: Whether the font is bold. (default: False)
|
||||
italic: Whether the font is italic. (default: False)
|
||||
underline: Whether the text is underlined. (default: False)
|
||||
strike_out: Whether the text is striked-out. (default: False)
|
||||
kerning: Whether kerning should be used while rendering the text. (default:
|
||||
False)
|
||||
strike_out: Whether the text is striked-out. (default: False)
|
||||
underline: Whether the text is underlined. (default: False)
|
||||
horizontal_align: Horizontal alignment of the text (default: "left")
|
||||
vertical_align: Vertical alignment of the text (defalt: "top")
|
||||
wrap: Whether word wrapping is enabled. (default: False)
|
||||
"""
|
||||
|
||||
text: str
|
||||
|
||||
@@ -22,9 +22,9 @@ class Grid(NamedTuple):
|
||||
This element is only used in case of isometric orientation, and determines how tile
|
||||
overlays for terrain and collision information are rendered.
|
||||
|
||||
[TMX Reference](https://doc.mapeditor.org/en/stable/reference/tmx-map-format/#tmx-grid)
|
||||
`TMX Reference <https://doc.mapeditor.org/en/stable/reference/tmx-map-format/#tmx-grid>`_
|
||||
|
||||
[JSON Reference](https://doc.mapeditor.org/en/stable/reference/json-map-format/#grid)
|
||||
`JSON Reference <https://doc.mapeditor.org/en/stable/reference/json-map-format/#grid>`_
|
||||
|
||||
Attributes:
|
||||
orientation: Orientation of the grid for the tiles in this tileset (orthogonal
|
||||
@@ -45,9 +45,9 @@ class Frame(NamedTuple):
|
||||
to a tile within the tileset, and gives a duration. Meaning that tile would be
|
||||
displayed for the given duration.
|
||||
|
||||
[TMX Reference](https://doc.mapeditor.org/en/stable/reference/tmx-map-format/#tmx-frame)
|
||||
`TMX Reference <https://doc.mapeditor.org/en/stable/reference/tmx-map-format/#tmx-frame>`_
|
||||
|
||||
[JSON Reference](https://doc.mapeditor.org/en/stable/reference/json-map-format/#json-frame)
|
||||
`JSON Reference <https://doc.mapeditor.org/en/stable/reference/json-map-format/#json-frame>`_
|
||||
|
||||
Attributes:
|
||||
tile_id: The local ID of a tile within the parent tile set object.
|
||||
@@ -68,9 +68,9 @@ class Transformations:
|
||||
the terrain system, however, could be used for any means a game/engine
|
||||
wants to really.
|
||||
|
||||
[TMX Reference](https://doc.mapeditor.org/en/stable/reference/tmx-map-format/#transformations)
|
||||
`TMX Reference <https://doc.mapeditor.org/en/stable/reference/tmx-map-format/#transformations>`_
|
||||
|
||||
[JSON Reference](https://doc.mapeditor.org/en/stable/reference/json-map-format/#transformations)
|
||||
`JSON Reference <https://doc.mapeditor.org/en/stable/reference/json-map-format/#transformations>`_
|
||||
|
||||
Attributes:
|
||||
hflip: Allow horizontal flip?
|
||||
@@ -92,9 +92,9 @@ class Tile:
|
||||
This class more closely resembles the JSON format than TMX. A number of values
|
||||
within this class in the TMX format are pulled into other sub-tags such as <image>.
|
||||
|
||||
[TMX Reference](https://doc.mapeditor.org/en/stable/reference/tmx-map-format/#tile)
|
||||
`TMX Reference <https://doc.mapeditor.org/en/stable/reference/tmx-map-format/#tile>`_
|
||||
|
||||
[JSON Reference](https://doc.mapeditor.org/en/stable/reference/json-map-format/#tile-definition)
|
||||
`JSON Reference <https://doc.mapeditor.org/en/stable/reference/json-map-format/#tile-definition>`_
|
||||
|
||||
Attributes:
|
||||
id: The local tile ID within it's tileset.
|
||||
@@ -135,11 +135,11 @@ class Tile:
|
||||
class Tileset:
|
||||
"""A Tileset is a collection of tiles.
|
||||
|
||||
As with the Tile class, this one more closely resembles the JSON format than TMX.
|
||||
This class much more closely resembles the JSON format than TMX.
|
||||
|
||||
[TMX Reference](https://doc.mapeditor.org/en/stable/reference/tmx-map-format/#tileset)
|
||||
`TMX Reference <https://doc.mapeditor.org/en/stable/reference/tmx-map-format/#tileset>`_
|
||||
|
||||
[JSON Reference](https://doc.mapeditor.org/en/stable/reference/json-map-format/#tileset)
|
||||
`JSON Reference <https://doc.mapeditor.org/en/stable/reference/json-map-format/#tileset>`_
|
||||
|
||||
Attributes:
|
||||
name: The name of this tileset.
|
||||
@@ -148,30 +148,38 @@ class Tileset:
|
||||
tile_count: The number of tiles in this tileset.
|
||||
columns: The number of tile columns in the tileset. For image collection
|
||||
tilesets it is editable and is used when displaying the tileset.
|
||||
spacing: The spacing in pixels between the tiles in this tileset (applies to
|
||||
the tileset image).
|
||||
firstgid: The global ID to give to the first Tile in this tileset. Global IDs
|
||||
for the rest of the tiles will increment from this number.
|
||||
spacing: The spacing in pixels between the tiles in this tileset (applies to
|
||||
the tileset image).
|
||||
type: Will always be `tileset`. Is statically included as a way to determine the
|
||||
type of a JSON file since Tiled does not have different extesnsions for map
|
||||
and tileset JSON files(as opposed to TMX/TSX files)
|
||||
spacing: Spacing between adjacent tiles in the image in pixels.
|
||||
margin: Buffer between the image edge and the first tile in the image in pixels.
|
||||
image: Used for spritesheet tile sets.
|
||||
image_width: The width of the `image` in pixels.
|
||||
image_height: The height of the `image` in pixels.
|
||||
transformations: What types of transformations are allowed on tiles within this
|
||||
Tileset
|
||||
background_color: The background color of the tileset.
|
||||
and tileset JSON files(as opposed to TMX/TSX files). This value will typically not be used.
|
||||
spacing: Spacing between adjacent tiles in the image in pixels. Defaults to 0.
|
||||
margin: Buffer between the image edge and the first tile in the image in pixels. Defaults to 0.
|
||||
tiled_version: The version of Tiled this tileset was saved with
|
||||
version: The version of the JSON or TSX format this tileset was saved with.
|
||||
This will typically be the same as the tiled_version parameter, but they are tracked separately
|
||||
mostly for futureproofing.
|
||||
image: The image file to be used for spritesheet tile sets.
|
||||
image_width: The width of the `image` in pixels. Only set if the image parameter is.
|
||||
This value is taken from whatever Tiled outputs, the image size is not calculated by pytiled-parser.
|
||||
image_height: The height of the `image` in pixels. Only set if the image parameter is.
|
||||
This value is taken from whatever Tiled outputs, the image size is not calculated by pytiled-parser.
|
||||
transformations: What types of transformations are allowed on tiles within
|
||||
this Tileset
|
||||
background_color: The background color of the tileset. This will typically only be
|
||||
used by the editor, but could be useful for displaying a TileSet if you had the need to do that.
|
||||
tileoffset: Used to specify an offset in pixels when drawing a tile from the
|
||||
tileset. When not present, no offset is applied.
|
||||
transparent_color: A color that acts as transparent on any tiles within the
|
||||
tileset.
|
||||
transparent_color: A color that should act as transparent on any tiles within the
|
||||
tileset. This would need to be taken into account by an implementation when loading the tile images.
|
||||
grid: Only used in case of isometric orientation, and determines how tile
|
||||
overlays for terrain and collision information are rendered.
|
||||
properties: The properties for this Tileset.
|
||||
tiles: Dict of Tile objects by Tile.id.
|
||||
wang_sets: List of WangSets used by the terrain system
|
||||
tiles: Dict of Tile objects with the Tile.id value as the key.
|
||||
wang_sets: List of WangSets, this is used by the terrain system in Tiled. It is unlikely an
|
||||
implementation in a game engine would need to use these values.
|
||||
alignment: Which alignment to use for tile objects from this tileset.
|
||||
"""
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ class WorldMap:
|
||||
|
||||
Attributes:
|
||||
map_file: A Path object to the map file, can be passed to
|
||||
[parse_map][pytiled_parser.parser.parse_map]
|
||||
the pytiled_parser.parse_map function later.
|
||||
size: The size of the map in pixels
|
||||
coordinates: The position of the map within the world in pixels
|
||||
"""
|
||||
@@ -49,8 +49,7 @@ class World:
|
||||
|
||||
Attributes:
|
||||
maps: The list of maps within the world. These are not fully parsed
|
||||
[TiledMap][pytiled_parser.tiled_map.TiledMap] objects, but rather
|
||||
[WorldMap][pytiled_parser.world.WorldMap] objects which can be used
|
||||
TiledMap objects, but rather WorldMap objects which can be used
|
||||
to later parse each individual map.
|
||||
only_show_adjacent: Largely only used by the Tiled editor to determine
|
||||
if only maps adjacent to the active one should be displayed. This
|
||||
|
||||
Reference in New Issue
Block a user