[][src]Module rs_tiled_json::tileset

The Tileset struct contains all of the information necessary for tile definitions.

Tilesets contain references to the image, have all of the relevant information to turn these images into graphical tiles, and include animation and collision data on a tile-by-tile basis (if any was defined in the editor, that is).

The most useful methods of the tileset are the following:

    pub fn coord_by_gid(&self, gid: u32) -> (u16, u16);
    pub fn anim_by_gid(&self, gid: u32, milliseconds: u32) -> (u16, u16);
    pub fn collision_by_gid(&self, gid: u32) -> Option<&Layer>;
    pub fn tile_by_gid(&self, gid: u32) -> Option<&Tile>;
    pub fn type_by_gid(&self, gid: u32) -> Option<&String>;
    pub fn properties_by_gid(&self, gid: u32) -> Option<&Vec<Property>>;

This struct implements the trait HasProperty, which enables easy access of Tiled properties for Tilesets. The relevant functions are:

    tiled_json::Tileset::get_property(&self, name: &str) -> Option<&tiled_json::Property>;
    tiled_json::Tileset::get_property_vector(&self) -> &Vec<tiled_json::Property>;
    tiled_json::Tileset::get_property_value(&self, name: &str) -> Option<&tiled_json::PropertyValue>;
    // See the tiled_json::Property struct to see functionality offered.

See Tiled JSON documentation at: https://doc.mapeditor.org/en/stable/reference/json-map-format/#tileset

Structs

Frame

Frame structure describes each moment in an animation. It has a tileid (the local identifier of the frame in a tileset; NOT a gid) and a duration.

Grid

This will define a custom grid within a tileset. I'm also not sure how this is used, but it is here in case it is needed. It has a height, width, and orientation as GridOrientation.

Tile

Tile contains data relevant to overrides of the tileset. This is for containing data specific to certain tiles within the tileset, such animations, collisions, different images, and properties.

TileOffset

TileOffset structure describes the offset of position for a Tileset. I'm not quite sure how it is used. It has an x and a y component.

Tileset

The primary means of capturing image data.

Enums

GridOrientation

GridOrientation is an enum that describes the orientation of a grid. It can be either Orthogonal or Isometric.