Check out our latest project ✨ OpenChapter.io: free ebooks the way its meant to be 📖

TileProps

An asset by ChrisSeadon
The page banner background of a mountain and forest
TileProps hero image

Quick Information

0 ratings
TileProps icon image
ChrisSeadon
TileProps

Implements a TileProps class for more flexible tile custom data. This allows the use of enums, meaning a tile can have a custom drop-down menu for mutually-exclusive states: e.g Floor/Wall/Door or similar.TileProps resources are automatically added to each tile on a tileset if it contains a custom data layer named 'Props' of type Object.A more detailed usage guide can be found in the README.md file.

Supported Engine Version
4.5
Version String
1.0.0
License Version
MIT
Support Level
community
Modified Date
1 day ago
Git URL
Issue URL

TileProps — Flexible custom data for TileSets in Godot 4.5

A plugin for Godot designed to increase the flexibility of custom data layers.

TileSet custom data layers in Godot only support a few types, and do not support enums. TileProps solves this using a global 'TileProps' class assigned to any created tile. This allows for scriptable properties and methods for tiles, and increases readability for mutually exclusive states via enums.

Installation

  1. Extract the .zip from the Releases tab into your project’s addons directory (e.g res://addons/tileprops_plugin).
  2. Enable in [Project Settings/Plugins]

Usage

Adapt the TileProps class as necessary with any properties and methods you require. It can be edited via the tileprops.gd script. The included examples properties are:

Walkable : Boolean

Type : TileType Enum (0: None, 1: Floor, 2: Wall)

For each new or existing tilemap, create a Custom Data Layer named Props*, and set its type to Object (Important).

image

The plugin will then automatically populate any existing tiles’ Props field with a new TileProps resource. Your custom fields can now be edited here!

Example TileProps Field

To access these properties in code, access the custom data layer as normal using the as keyword to adopt the TileProps type.

Example (GDScript):

var tile_props = example_tilemap_layer.get_cell_tile_data(coords).get_custom_data("Props") as TileProps
#Accessing properties
var is_walkable : bool = tile_props.Walkable

Example (C#):

var tileProps = exampleTileMapLayer.GetCellTileData(coords).GetCustomData("Props").As<TileProps>();
//Accessing properties
bool isWalkable = tileProps.Walkable;

*The layer name can be edited via the PROPS_FIELD_NAME constant in the tileprops_plugin.gd script.

Additional Information

Currently tested for tilesets up to 64*64 in size.

Contributions are welcome. Godot’s available EditorInterface methods and signals are somewhat lacking, meaning there are some hacks and workarounds in here that likely have more elegant solutions.

Implements a TileProps class for more flexible tile custom data. This allows the use of enums, meaning a tile can have a custom drop-down menu for mutually-exclusive states: e.g Floor/Wall/Door or similar.

TileProps resources are automatically added to each tile on a tileset if it contains a custom data layer named 'Props' of type Object.

A more detailed usage guide can be found in the README.md file.

Reviews

0 ratings

Your Rating

Headline must be at least 3 characters but not more than 50
Review must be at least 5 characters but not more than 500
Please sign in to add a review

Quick Information

0 ratings
TileProps icon image
ChrisSeadon
TileProps

Implements a TileProps class for more flexible tile custom data. This allows the use of enums, meaning a tile can have a custom drop-down menu for mutually-exclusive states: e.g Floor/Wall/Door or similar.TileProps resources are automatically added to each tile on a tileset if it contains a custom data layer named 'Props' of type Object.A more detailed usage guide can be found in the README.md file.

Supported Engine Version
4.5
Version String
1.0.0
License Version
MIT
Support Level
community
Modified Date
1 day ago
Git URL
Issue URL

Open Source

Released under the AGPLv3 license

Plug and Play

Browse assets directly from Godot

Community Driven

Created by developers for developers