godot-tilemap
БесплатноБез исполняемых скриптовНе проверенGodot 4.7 tile maps with TileMapLayer and TileSet: atlas sources, data layers, terrain autotiling and set_cell or local_to_map at runtime. Use for 2D tile…
от gamedev-skills★ 12 656 звёзд на GitHubОб этом скилле
Godot TileMap (4.7 TileMapLayer)
Author tile levels with TileMapLayer + TileSet, attach per-tile collision and data,
autotile with terrains, and edit cells at runtime. Targets Godot 4.7, where
TileMapLayer replaces the deprecated TileMap node (see Version notes).
When to use
- 2D levels on a tile grid, configuring a
TileSet(collision, navigation, custom data, terrains), or reading/writing tiles from code. - Migrating a
TileMapnode (one node, many layers) toTileMapLayernodes.
When not to use: moving the player across tiles → godot-2d-movement; general
bodies and raycasts → godot-physics; generation algorithms → procedural-gen; level
design practice → level-design; 3D grids → godot-3d-essentials (GridMap).
Core workflow
- One
TileMapLayerper layer (background, walls, foreground), grouped under aNode2D. All layers share oneTileSetsaved as an external.tres. - Build the TileSet. The TileSet editor is click-only, so when you cannot drive the
editor, generate the
.treswith a headless tool script (Pattern 1) and keep that script in the repo. Otherwise, ask the user to make the change in the editor and report the source id, atlas coordinates and layer names. - Add data layers on the TileSet: physics layers (collision polygons plus their
collision layer/mask bits), navigation layers, occlusion, and typed custom data layers
(
damage: int,is_ladder: bool). - Place tiles from code with
set_cell,set_cells_terrain_connectorset_cells_terrain_path. The cells in a.tscnare an encodedtile_map_databyte array, so never edit them by hand; write a generator script or ask the user to paint in the editor. - Per-layer collision/navigation are on by default (
collision_enabled/navigation_enabled=trueon eachTileMapLayer); turn them off on decorative layers that should not collide or carry navigation. - Check before you finish.
- Run the
godot-nodes-scenesskill'sscripts/check_godot_project.py <project-dir>to catch a TileSet.treswhose texture or script path is broken. - Prove the tiles behave with a headless test (Pattern 4): on a fresh checkout run
godot --headless --path . --importfirst so the tile texture is imported, thengodot --headless --path . --script res://tests/test_tiles.gd, and read the exit code. With no Godot binary (godot,godot4or$GODOT_BIN), ask the user to run it and paste the output. For a visual check, ask the user to rungodot --path . --debug-collisionsand report whether walls show shapes.
- Run the
Patterns
1. Generate a TileSet .tres in code
# res://tools/make_tileset.gd
# Run: godot --headless --path . --script res://tools/make_tileset.gd
extends SceneTree
func _initialize() -> void:
var tile_set := TileSet.new()
tile_set.tile_size = Vector2i(16, 16)
tile_set.add_physics_layer()
tile_set.set_physics_layer_collision_layer(0, 1 << 1) # bit 2 ("walls")
tile_set.add_custom_data_layer()
tile_set.set_custom_data_layer_name(0, "damage")
tile_set.set_custom_data_layer_type(0, TYPE_INT)
var atlas := TileSetAtlasSource.new()
atlas.texture = load("res://art/tiles.png")
atlas.texture_region_size = Vector2i(16, 16)
tile_set.add_source(atlas, 0) # add before creating tiles
atlas.create_tile(Vector2i(2, 1)) # column 2, row 1 of the texture
var wall := atlas.get_tile_data(Vector2i(2, 1), 0)
wall.add_collision_polygon(0)
wall.set_collision_polygon_points(0, 0, PackedVector2Array([
Vector2(-8, -8), Vector2(8, -8), Vector2(8, 8), Vector2(-8, 8)])) # cell-centred
wall.set_custom_data("damage", 0)
var err := ResourceSaver.save(tile_set, "res://tiles/world_tileset.tres")
print("saved tileset: ", error_string(err))
quit(0 if err == OK else 1)
Add the source to the TileSet before create_tile, so the tile's data knows the TileSet's
physics and custom data layers. Polygon points are relative to the cell centre.
2. Mouse position to a cell, then read custom data
extends TileMapLayer
func _unhandled_input(event: InputEvent) -> void:
if event is InputEventMouseButton and event.pressed:
# event.position is in viewport pixels and ignores Camera2D scroll/zoom.
var local_event := make_input_local(event) as InputEventMouseButton
var cell := local_to_map(local_event.position)
var data := get_cell_tile_data(cell) # TileData or null
if data:
var dmg: int = data.get_custom_data("damage")
print("Cell %s deals %d damage" % [cell, dmg])
3. Place, erase and autotile at runtime
func place_wall(cell: Vector2i) -> void:
set_cell(cell, 0, Vector2i(2, 1)) # source 0, atlas tile at column 2, row 1
func dig(cell: Vector2i) -> void:
erase_cell(cell) #
Установить godot-tilemap в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл godot-tilemap?
Godot 4.7 tile maps with TileMapLayer and TileSet: atlas sources, data layers, terrain autotiling and set_cell or local_to_map at runtime. Use for 2D tile levels in Godot, tiles with no collision, a click on the wrong cell or porting a deprecated TileMap. Not for Unity (`unity-tilemap-2d`), tile art (`create-game-assets`) or generation (`procedural-gen`).
Как установить скилл godot-tilemap?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл godot-tilemap запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic