Bases: tmxlib.helpers.TileMixin
Base tile-like object: regular tile or tile object.
Has an associated layer and value, and can be flipped, etc.
A TileLikeObject is “true” iff there’s a tile associated with it. Empty, “false” tiles have a GID of zero.
Note
Subclasses should use the _value attribute for your own purposes. The value allows setting itself to TilesetTiles, has checks, etc.
Numeric value of a tile, representing the image and transformations.
See the TMX format for a hopefully more detailed specification. The upper bits of this number are used for flags:
- 0x80000000: tile is flipped horizontally.
- 0x40000000: tile is flipped vertically.
- 0x20000000: tile is flipped diagonally (axes are swapped).
- 0x10000000: tmxlib reserves this bit for now, just because 0x0FFFFFFF is a nice round number.
The rest of the value is zero if the layer is empty at the corresponding spot (or an object has no associated tile image), or it holds the GID of the tileset-tile.
The GID can be computed as 1 + X + Y where X is the number of tiles in all tilesets preceding the tile’s, and Y is the number of the tile within its tileset.
The individual parts of value are reflected in individual properties:
- flipped_horizontally (0x80000000)
- flipped_vertically (0x40000000)
- flipped_diagonally (0x20000000)
- gid (0x0FFFFFFF)
The properties themselves have a value attribute, e.g. tmxlib.MapTile.flipped_diagonally.value == 0x20000000.
Get the image of the tile. (N.B. see full docstring!)
N.B. No transformations are applied to the image. This can change in future versions. Use self.tileset_tile.image for future-safe behavior.
Flipping helpers:
Inherited:
References a particular spot on a tile layer
MapTile object can be hashed and they compare equal if they refer to the same tile of the same layer.
init arguments, which become attributes:
See TileLikeObject for attributes and methods shered with tile objects.
Properties of the referenced tileset-tile
Note
Changing this will change properties of all tiles using this image. Possibly even across more maps if tilesets are shared.
See TilesetTile.