godot-tilemap-sh-654b5e

A Godot TileMap–specific skill to help an AI agent efficiently accomplish tasks related to Godot TileMap.

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "godot-tilemap-sh-654b5e" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-7b7c32dfc14c3de6160d0d8cf55dfb5ef66b82c13b48738c7028fb1772e6e3d2. Verify the upstream source and version against https://skillhub.cn/skills/user_3c6cb52e/godot-tilemap-sh-654b5e before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

skillhub.cn

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

A Godot TileMap–specific skill to help an AI agent efficiently accomplish tasks related to Godot TileMap.

0 Downloads

Introduction source: third_party · user_3c6cb52e · 1.0.0 Reference

SkillPi interpretation

Tasks
Author tile-based levels with `TileMapLayer` + `TileSet`, add per-tile collision and custom data, autotile with terrains, and manipulate cells at runtime. Targets Godot 4.3+**, where `TileMapLayer` replaces the now-deprecated `TileMap` node.
Audience
Use when designing 2D levels from a tile grid, configuring a `TileSet` (collision, navigation, custom data, terrains), or reading/writing tiles from code. Use when migrating a `TileMap` node (single node, many layers) to multiple `TileMapLayer` nodes (one layer each). When *not* to use:** moving the player across the tiles → `godot-2d-movement`; general physics bodies/raycasts → `godot-physics`; procedural map *generation* algorithms → `procedural-gen`; level *design* practice → `level-design`.
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: Godottilemap
slug: godot-tilemap
version: 1.0.0
displayName: Godottilemap
description: >
  Godottilemap专用技能,帮助AI Agent高效完成相关任务。
  Godottilemap专用技能,帮助AI Agent高效完成相关任务。
summary: "Godottilemap专用技能,帮助AI Agent高效完成相关任务。"
license: Apache-2.0
category: 游戏开发
framework:
  - Claude Code
  - Codex
  - Hermes Agent
  - OpenClaw
  - QClaw
  - WorkBuddy
platform: multi-platform
homepage: "https://github.com/1991513ccie-png"
repository: "https://github.com/1991513ccie-png"

Godot TileMap (4.3+ TileMapLayer)

Author tile-based levels with TileMapLayer + TileSet, add per-tile collision and custom data, autotile with terrains, and manipulate cells at runtime. Targets Godot 4.3+, where TileMapLayer replaces the now-deprecated TileMap node.

When to use

  • Use when designing 2D levels from a tile grid, configuring a TileSet (collision, navigation, custom data, terrains), or reading/writing tiles from code.
  • Use when migrating a TileMap node (single node, many layers) to multiple TileMapLayer nodes (one layer each).

When not to use: moving the player across the tiles → godot-2d-movement; general physics bodies/raycasts → godot-physics; procedural map generation algorithms → procedural-gen; level design practice → level-design.

Core workflow

  1. Add a TileMapLayer node (one per visual/logical layer: background, walls, foreground). Each holds exactly one layer of tiles.
  2. Create or assign a TileSet on the layer's tile_set property. Add an atlas source (a texture sliced into tiles) in the TileSet editor. Save the TileSet as an external .tres so multiple layers/levels reuse it.
  3. Add tile data in the TileSet editor: physics layers (collision polygons), navigation layers, occlusion, and custom data layers (typed per-tile values like damage or is_ladder).
  4. Paint in the TileMap bottom panel (Paint/Line/Rectangle/Bucket). For self- connecting tiles, define a terrain set and paint with Connect/Path mode.
  5. Enable per-layer collision/navigation via the layer's collision_enabled / navigation_enabled properties.
  6. Read/write from code with local_to_map, set_cell, get_cell_source_id, and get_cell_tile_data(...).get_custom_data(...).

Patterns

1. Convert mouse position to a cell and read its custom data

extends TileMapLayer

func _unhandled_input(event: InputEvent) -> void:
    if event is InputEventMouseButton and event.pressed:
        # local_to_map expects local coords; convert from global first.
        var cell := local_to_map(to_local(event.position))
        var data := get_cell_tile_data(cell)   # TileData or null
        if data:
            var dmg: int = data.get_custom_data("damage")  # custom data layer
            print("Cell %s deals %d damage" % [cell, dmg])

2. Place and erase tiles at runtime

# set_cell(coords, source_id, atlas_coords, alternative_tile = 0)
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)                    # same as set_cell(cell, -1)

func clear_level() -> void:
    clear()                             # remove every tile on this layer

3. Autotiling a region with a terrain set

# Paint a filled area with terrain `terrain` of terrain set `terrain_set`;
# Godot picks the correct edge/corner tiles to connect them.
func fill_with_grass(cells: Array[Vector2i]) -> void:
    var terrain_set := 0
    var grass_terrain := 0
    set_cells_terrain_connect(cells, terrain_set, grass_terrain, true)

4. Iterate placed tiles (e.g. find all spawn tiles)

func find_spawns() -> Array[Vector2i]:
    var spawns: Array[Vector2i] = []
    for cell in get_used_cells():
        var data := get_cell_tile_data(cell)
        if data and data.get_custom_data("is_spawn"):
            spawns.append(cell)
    return spawns

Pitfalls

  • TileMap node is deprecated in 4.3. Use TileMapLayer nodes (one layer per node); group them under a parent Node2D. Old TileMap calls that took a layer argument (set_cell(layer, ...)) do not apply to TileMapLayer.
  • local_to_map needs local coordinates. Mouse/global positions must be converted with to_local(...) first, or cells will be offset.
  • get_cell_tile_data returns null for empty cells or non-atlas sources — always null-check before get_custom_data.
  • Custom data is typed. A layer declared as int returns int; reading it as the wrong type or referencing a non-existent layer name errors. Define the layer in the TileSet first.
  • Terrains need every combination defined. set_cells_terrain_connect produces odd results if the TileSet's terrain bitmask peering is incomplete.
  • Runtime edits are batched to end-of-frame. If you must read updated internals immediately after set_cell, call update_internals() (expensive — avoid in loops).
  • Collision not working? Check the layer's collision_enabled, that the tile has a physics layer with a polygon, and that the TileSet's physics layer mask matches your bodies.

References

  • For TileSet setup (atlas sources, physics/navigation/custom-data layers, terrain bitmasks), scene tiles, Y-sorting, and runtime tile-data overrides (_use_tile_data_runtime_update), read references/tileset-and-terrains.md.

Related skills

  • godot-2d-movement — characters that walk on these tiles.
  • godot-physics — collision layers/masks the tile collisions participate in.
  • procedural-gen — generating tilemaps from noise/RNG.
  • level-design / roguelike — design practice and grid-based genres.

Current listing version

1.0.0

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value85/100

Highlights

  • 针对 Godot 4.3+ TileMapLayer 提供完整工作流和避坑指南
  • 包含多个实用代码示例(鼠标交互、运行时编辑、自动拼接、遍历查找)
  • 明确区分了适用与不适用场景,避免误用
Trigger Precision70/100

Areas to improve

  • description 内容重复且模糊 Reported severity: Minor

    顶层 description 和 frontmatter description 均为重复的模糊描述,缺乏具体触发条件说明

    Recommendation: 建议将 description 改写为具体功能描述,如 '用于在 Godot 4.3+ 中创建、编辑和管理 TileMapLayer 地图,支持自定义数据、碰撞配置和运行时操作'

Highlights

  • skill_body 中 'When to use' 和 'When not to use' 提供了较清晰的场景边界
Structure and Standards90/100

Highlights

  • 结构完整,包含工作流、模式、陷阱、参考等必要章节
  • 提供多个端到端代码示例,便于理解和使用
  • frontmatter 信息完整,包含版本、分类、框架支持等
Execution Reliability90/100

Highlights

  • 工具来源明确(Godot 官方 API),参数使用规范
  • 覆盖了主要异常情况(null 检查、坐标转换、类型匹配)
  • 对不可逆操作(如 clear)有明确说明
Evidence Verifiability (mean of the first four)84/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

These common operations were not identified in the main document. This does not mean no permissions or risks exist.

Domains or addresses referenced in the document

These addresses may be documentation links or examples, not an approved network allowlist. Verify actual destinations and outgoing data before use.

  • github.com

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.