Skip to content

PixelTileMapLayer

Extends TileMapLayer. Read from the plugin's source on every build.

A TileMapLayer painted with a tileset document’s tiles.

Give it a .tiles.tres and it paints with Godot’s own tile editor at once: its tile_set is a PixelTileSet over the document, so the ground’s artwork, collision, custom data and terrains follow the document as it is drawn, in the editor and in a game the dock pushes a save to.

The layer’s tile_set stays an ordinary property. Setting the document reuses a PixelTileSet already there, so a collision mask set on its physics layer survives a new document; a tile_set that is not one is replaced.

Properties

document

@export var document: PixelTilesDocument

The tileset document this layer paints with.

Methods

place_tile

func place_tile(at: Vector2i, tile: Variant) -> bool

Lays tile on the cell at, the atlas cell of its PixelTile.cell on the set’s one source, and answers true; or false, laying nothing, for no document or a tile it does not declare on its sheet. tile is a PixelTile of document, or a tile’s name as PixelTilesDocument.tile_named finds it, so a game’s script fills a level by name: layer.place_tile(Vector2i(3, 4), "tree"). Clear a cell with erase_cell.

tile_at

func tile_at(at: Vector2i) -> PixelTile

The tile of document laid on the cell at, or null for an empty cell, one off the set’s source, or one whose atlas cell the document no longer declares.

JamChip, by GlitterSnack. MIT licence. Built from the source on every merge. Its artwork and screenshots are made with JamChip.