tilemap
Read, copy, edit, fill, clear, paste, and transform TileMap nodes in Godot at runtime, with operations affecting only the current execution context.
Instructions
TileMap/TileMapLayer 图块操作。读取: tilemap_read, tilemap_copy。写入: tilemap_set_cell, tilemap_erase_cell, tilemap_fill_rect, tilemap_clear, tilemap_paste, tilemap_set_transform。运行时操作,仅影响当前执行上下文。如需持久化,请编辑 .tscn 文件。
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| layer | No | 图层索引(可选,默认 0)。tilemap_read/set_cell/erase_cell/fill_rect/copy/paste/set_transform 使用;tilemap_clear 不传则清除所有图层 | |
| action | Yes | 操作类型 | |
| coords | No | 图块坐标 Vector2i。tilemap_set_cell/erase_cell/set_transform 使用 | |
| flip_h | No | 水平翻转(可选,默认 false)。tilemap_set_transform 使用 | |
| flip_v | No | 垂直翻转(可选,默认 false)。tilemap_set_transform 使用 | |
| region | No | 矩形区域 Rect2i。tilemap_read: 读取区域(可选,不传则读取全部已用图块);tilemap_fill_rect: 填充区域 | |
| target | No | 粘贴目标坐标 Vector2i。tilemap_paste 使用 | |
| pattern | No | 图块图案(由 tilemap_copy 返回的 pattern 对象)。tilemap_paste 使用 | |
| node_path | No | TileMap/TileMapLayer 节点路径(如 root/Level/TileMap) | |
| source_id | No | TileSet 源 ID。tilemap_set_cell/fill_rect 使用 | |
| transpose | No | 转置(可选,默认 false)。tilemap_set_transform 使用 | |
| atlas_coords | No | 图集坐标 Vector2i。tilemap_set_cell/fill_rect 使用 | |
| project_path | No | Godot 项目目录路径(可选,默认使用 GODOT_PROJECT_PATH 环境变量或当前目录) | |
| source_region | No | 源区域 Rect2i。tilemap_copy 使用 | |
| load_autoloads | No | 是否加载 Autoload 上下文(默认 true) | |
| alternative_tile | No | 替代图块索引(可选,默认 0)。tilemap_set_cell/fill_rect 使用 |