[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M79NZH6EFK2WEDC2KBA5V0GV":3,"skill-same:01M79NZH6EFK2WEDC2KBA5V0GV":51},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":14,"repositoryHtmlUrl":27,"repositoryHomepageUrl":6,"ownerHtmlUrl":28,"ownerBlogUrl":6,"ownerDescription":29,"updatedAt":30,"install":31,"resources":44},"01M79NZH6EFK2WEDC2KBA5V0GV","godot-tilemap",null,"Build and edit tile-based 2D levels in Godot 4.7 with TileMapLayer and TileSet: paint layers, set up collision\u002Fnavigation\u002Fcustom-data on tiles, autotile with terrain sets, and read\u002Fwrite cells from code (set_cell, get_cell_tile_data, local_to_map). Use when working with TileMapLayer nodes, .tres TileSets, autotiling, or migrating a deprecated TileMap node to TileMapLayer.","JunMystery\u002FAgent-Guidance","JunMystery","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F161468934?v=4","01M79MTMV8F0BY8NK1A92RA8A0","Jun","01M79MTMWCFBKPHN5B25E6V20B",0,"MIT","https:\u002F\u002Fgithub.com\u002FJunMystery\u002FAgent-Guidance\u002Fblob\u002Fmain\u002Fskills\u002Fgodot-tilemap\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: godot-tilemap\ndescription: >\n  Build and edit tile-based 2D levels in Godot 4.7 with TileMapLayer and TileSet:\n  paint layers, set up collision\u002Fnavigation\u002Fcustom-data on tiles, autotile with\n  terrain sets, and read\u002Fwrite cells from code (set_cell, get_cell_tile_data,\n  local_to_map). Use when working with TileMapLayer nodes, .tres TileSets, autotiling,\n  or migrating a deprecated TileMap node to TileMapLayer.\n---\n\n# Godot TileMap (4.7 TileMapLayer)\n\nAuthor tile-based levels with `TileMapLayer` + `TileSet`, add per-tile collision and\ncustom data, autotile with terrains, and manipulate cells at runtime. Targets\n**Godot 4.7**, where `TileMapLayer` replaces the now-deprecated `TileMap` node.\n\n## When to use\n\n- Use when designing 2D levels from a tile grid, configuring a `TileSet` (collision,\n  navigation, custom data, terrains), or reading\u002Fwriting tiles from code.\n- Use when migrating a `TileMap` node (single node, many layers) to multiple\n  `TileMapLayer` nodes (one layer each).\n\n**When *not* to use:** moving the player across the tiles → `godot-2d-movement`; general\nphysics bodies\u002Fraycasts → `godot-physics`; procedural map *generation* algorithms →\n`procedural-gen`; level *design* practice → `level-design`.\n\n## Core workflow\n\n1. **Add a `TileMapLayer` node** (one per visual\u002Flogical layer: background, walls,\n   foreground). Each holds exactly one layer of tiles.\n2. **Create or assign a `TileSet`** on the layer's `tile_set` property. Add an atlas\n   source (a texture sliced into tiles) in the TileSet editor. Save the TileSet as an\n   external `.tres` so multiple layers\u002Flevels reuse it.\n3. **Add tile data in the TileSet editor:** physics layers (collision polygons),\n   navigation layers, occlusion, and **custom data layers** (typed per-tile values like\n   `damage` or `is_ladder`).\n4. **Paint** in the TileMap bottom panel (Paint\u002FLine\u002FRectangle\u002FBucket). For self-\n   connecting tiles, define a **terrain set** and paint with Connect\u002FPath mode.\n5. **Enable per-layer collision\u002Fnavigation** via the layer's `collision_enabled` \u002F\n   `navigation_enabled` properties.\n6. **Read\u002Fwrite from code** with `local_to_map`, `set_cell`, `get_cell_source_id`, and\n   `get_cell_tile_data(...).get_custom_data(...)`.\n\n## Patterns\n\n### 1. Convert mouse position to a cell and read its custom data\n\n```gdscript\nextends TileMapLayer\n\nfunc _unhandled_input(event: InputEvent) -> void:\n    if event is InputEventMouseButton and event.pressed:\n        # event.position is in viewport pixels and ignores Camera2D scroll\u002Fzoom.\n        # make_input_local() converts it into this layer's local space.\n        var local_event := make_input_local(event) as InputEventMouseButton\n        var cell := local_to_map(local_event.position)\n        var data := get_cell_tile_data(cell)   # TileData or null\n        if data:\n            var dmg: int = data.get_custom_data(\"damage\")  # custom data layer\n            print(\"Cell %s deals %d damage\" % [cell, dmg])\n```\n\n### 2. Place and erase tiles at runtime\n\n```gdscript\n# set_cell(coords, source_id, atlas_coords, alternative_tile = 0)\nfunc place_wall(cell: Vector2i) -> void:\n    set_cell(cell, 0, Vector2i(2, 1))   # source 0, atlas tile at column 2, row 1\n\nfunc dig(cell: Vector2i) -> void:\n    erase_cell(cell)                    # same as set_cell(cell, -1)\n\nfunc clear_level() -> void:\n    clear()                             # remove every tile on this layer\n```\n\n### 3. Autotiling a region with a terrain set\n\n```gdscript\n# Paint a filled area with terrain `terrain` of terrain set `terrain_set`;\n# Godot picks the correct edge\u002Fcorner tiles to connect them.\nfunc fill_with_grass(cells: Array[Vector2i]) -> void:\n    var terrain_set := 0\n    var grass_terrain := 0\n    set_cells_terrain_connect(cells, terrain_set, grass_terrain, true)\n```\n\n### 4. Iterate placed tiles (e.g. find all spawn tiles)\n\n```gdscript\nfunc find_spawns() -> Array[Vector2i]:\n    var spawns: Array[Vector2i] = []\n    for cell in get_used_cells():\n        var data := get_cell_tile_data(cell)\n        if data and data.get_custom_data(\"is_spawn\"):\n            spawns.append(cell)\n    return spawns\n```\n\n## Pitfalls\n\n- **`TileMap` node is deprecated in 4.3.** Use `TileMapLayer` nodes (one layer per node);\n  group them under a parent `Node2D`. Old `TileMap` calls that took a `layer` argument\n  (`set_cell(layer, ...)`) do not apply to `TileMapLayer`.\n- **`local_to_map` needs layer-local coordinates.** A world position needs `to_local(...)`\n  first. A mouse event's `position` is in viewport pixels, not world space, so it is wrong as\n  soon as a `Camera2D` scrolls or zooms; convert it with `make_input_local(event)` (or\n  poll `get_local_mouse_position()`) instead.\n- **`get_cell_tile_data` returns `null`** for empty cells or non-atlas sources — always\n  null-check before `get_custom_data`.\n- **Custom data is typed.** A layer declared as `int` returns `int`; reading it as the\n  wrong type or referencing a non-existent layer name errors. Define the layer in the\n  TileSet first.\n- **Terrains need every combination defined.** `set_cells_terrain_connect` produces odd\n  results if the TileSet's terrain bitmask peering is incomplete.\n- **Runtime edits are batched** to end-of-frame. If you must read updated internals\n  immediately after `set_cell`, call `update_internals()` (expensive — avoid in loops).\n- **Collision not working?** Check the layer's `collision_enabled`, that the tile has a\n  physics layer with a polygon, and that the TileSet's physics layer mask matches your\n  bodies.\n\n## References\n\n- For TileSet setup (atlas sources, physics\u002Fnavigation\u002Fcustom-data layers, terrain\n  bitmasks), scene tiles, Y-sorting, and runtime tile-data overrides\n  (`_use_tile_data_runtime_update`), read `references\u002Ftileset-and-terrains.md`.\n\n## Related skills\n\n- `godot-2d-movement` — characters that walk on these tiles.\n- `godot-physics` — collision layers\u002Fmasks the tile collisions participate in.\n- `procedural-gen` — generating tilemaps from noise\u002FRNG.\n- `level-design` \u002F `roguelike` — design practice and grid-based genres.\n","# Godot TileMap (4.7 TileMapLayer)\n\nAuthor tile-based levels with `TileMapLayer` + `TileSet`, add per-tile collision and\ncustom data, autotile with terrains, and manipulate cells at runtime. Targets\n**Godot 4.7**, where `TileMapLayer` replaces the now-deprecated `TileMap` node.\n\n## When to use\n\n- Use when designing 2D levels from a tile grid, configuring a `TileSet` (collision,\n  navigation, custom data, terrains), or reading\u002Fwriting tiles from code.\n- Use when migrating a `TileMap` node (single node, many layers) to multiple\n  `TileMapLayer` nodes (one layer each).\n\n**When *not* to use:** moving the player across the tiles → `godot-2d-movement`; general\nphysics bodies\u002Fraycasts → `godot-physics`; procedural map *generation* algorithms →\n`procedural-gen`; level *design* practice → `level-design`.\n\n## Core workflow\n\n1. **Add a `TileMapLayer` node** (one per visual\u002Flogical layer: background, walls,\n   foreground). Each holds exactly one layer of tiles.\n2. **Create or assign a `TileSet`** on the layer's `tile_set` property. Add an atlas\n   source (a texture sliced into tiles) in the TileSet editor. Save the TileSet as an\n   external `.tres` so multiple layers\u002Flevels reuse it.\n3. **Add tile data in the TileSet editor:** physics layers (collision polygons),\n   navigation layers, occlusion, and **custom data layers** (typed per-tile values like\n   `damage` or `is_ladder`).\n4. **Paint** in the TileMap bottom panel (Paint\u002FLine\u002FRectangle\u002FBucket). For self-\n   connecting tiles, define a **terrain set** and paint with Connect\u002FPath mode.\n5. **Enable per-layer collision\u002Fnavigation** via the layer's `collision_enabled` \u002F\n   `navigation_enabled` properties.\n6. **Read\u002Fwrite from code** with `local_to_map`, `set_cell`, `get_cell_source_id`, and\n   `get_cell_tile_data(...).get_custom_data(...)`.\n\n## Patterns\n\n### 1. Convert mouse position to a cell and read its custom data\n\n```gdscript\nextends TileMapLayer\n\nfunc _unhandled_input(event: InputEvent) -> void:\n    if event is InputEventMouseButton and event.pressed:\n        # event.position is in viewport pixels and ignores Camera2D scroll\u002Fzoom.\n        # make_input_local() converts it into this layer's local space.\n        var local_event := make_input_local(event) as InputEventMouseButton\n        var cell := local_to_map(local_event.position)\n        var data := get_cell_tile_data(cell)   # TileData or null\n        if data:\n            var dmg: int = data.get_custom_data(\"damage\")  # custom data layer\n            print(\"Cell %s deals %d damage\" % [cell, dmg])\n```\n\n### 2. Place and erase tiles at runtime\n\n```gdscript\n# set_cell(coords, source_id, atlas_coords, alternative_tile = 0)\nfunc place_wall(cell: Vector2i) -> void:\n    set_cell(cell, 0, Vector2i(2, 1))   # source 0, atlas tile at column 2, row 1\n\nfunc dig(cell: Vector2i) -> void:\n    erase_cell(cell)                    # same as set_cell(cell, -1)\n\nfunc clear_level() -> void:\n    clear()                             # remove every tile on this layer\n```\n\n### 3. Autotiling a region with a terrain set\n\n```gdscript\n# Paint a filled area with terrain `terrain` of terrain set `terrain_set`;\n# Godot picks the correct edge\u002Fcorner tiles to connect them.\nfunc fill_with_grass(cells: Array[Vector2i]) -> void:\n    var terrain_set := 0\n    var grass_terrain := 0\n    set_cells_terrain_connect(cells, terrain_set, grass_terrain, true)\n```\n\n### 4. Iterate placed tiles (e.g. find all spawn tiles)\n\n```gdscript\nfunc find_spawns() -> Array[Vector2i]:\n    var spawns: Array[Vector2i] = []\n    for cell in get_used_cells():\n        var data := get_cell_tile_data(cell)\n        if data and data.get_custom_data(\"is_spawn\"):\n            spawns.append(cell)\n    return spawns\n```\n\n## Pitfalls\n\n- **`TileMap` node is deprecated in 4.3.** Use `TileMapLayer` nodes (one layer per node);\n  group them under a parent `Node2D`. Old `TileMap` calls that took a `layer` argument\n  (`set_cell(layer, ...)`) do not apply to `TileMapLayer`.\n- **`local_to_map` needs layer-local coordinates.** A world position needs `to_local(...)`\n  first. A mouse event's `position` is in viewport pixels, not world space, so it is wrong as\n  soon as a `Camera2D` scrolls or zooms; convert it with `make_input_local(event)` (or\n  poll `get_local_mouse_position()`) instead.\n- **`get_cell_tile_data` returns `null`** for empty cells or non-atlas sources — always\n  null-check before `get_custom_data`.\n- **Custom data is typed.** A layer declared as `int` returns `int`; reading it as the\n  wrong type or referencing a non-existent layer name errors. Define the layer in the\n  TileSet first.\n- **Terrains need every combination defined.** `set_cells_terrain_connect` produces odd\n  results if the TileSet's terrain bitmask peering is incomplete.\n- **Runtime edits are batched** to end-of-frame. If you must read updated internals\n  immediately after `set_cell`, call `update_internals()` (expensive — avoid in loops).\n- **Collision not working?** Check the layer's `collision_enabled`, that the tile has a\n  physics layer with a polygon, and that the TileSet's physics layer mask matches your\n  bodies.\n\n## References\n\n- For TileSet setup (atlas sources, physics\u002Fnavigation\u002Fcustom-data layers, terrain\n  bitmasks), scene tiles, Y-sorting, and runtime tile-data overrides\n  (`_use_tile_data_runtime_update`), read `references\u002Ftileset-and-terrains.md`.\n\n## Related skills\n\n- `godot-2d-movement` — characters that walk on these tiles.\n- `godot-physics` — collision layers\u002Fmasks the tile collisions participate in.\n- `procedural-gen` — generating tilemaps from noise\u002FRNG.\n- `level-design` \u002F `roguelike` — design practice and grid-based genres.\n",{"name":5,"description":7},"main","5d0a87185c0e172c3901e2a6e5916b6d544b8b94","skills\u002Fgodot-tilemap","https:\u002F\u002Fgithub.com\u002FJunMystery\u002FAgent-Guidance","https:\u002F\u002Fgithub.com\u002FJunMystery","AI is the typist, I am the architect. Building efficient, secure, and user-centric products through disciplined AI prompt engineering.","2026-11-13 17:41:25",{"source":8,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add JunMystery\u002FAgent-Guidance --skill godot-tilemap",{"tool":37,"command":38},"bunx","bunx skills add JunMystery\u002FAgent-Guidance --skill godot-tilemap",{"tool":40,"command":41},"pnpm","pnpm dlx skills add JunMystery\u002FAgent-Guidance --skill godot-tilemap","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FJunMystery\u002FAgent-Guidance\u002Fblob\u002Fmain\u002Fskills\u002Fgodot-tilemap\u002FSKILL.md",true,[45],{"path":46,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":49,"sourceHtmlUrl":50},"references\u002Ftileset-and-terrains.md","REFERENCE","参考文档",4094,"https:\u002F\u002Fgithub.com\u002FJunMystery\u002FAgent-Guidance\u002Fblob\u002Fmain\u002Fskills\u002Fgodot-tilemap\u002Freferences\u002Ftileset-and-terrains.md",[52,58,64,70,76,82],{"skillNo":53,"name":54,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":55,"categories":56,"keywords":57,"publishedAt":19},"01M79QR1E309VJ6CTQKB32AWWA","zero-trust-architecture-cheat-sheet","https:\u002F\u002Fgithub.com\u002FJunMystery\u002FAgent-Guidance\u002Fblob\u002Fmain\u002Fskills\u002Fzero-trust-architecture-cheat-sheet\u002FSKILL.md",[],[],{"skillNo":59,"name":60,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":61,"categories":62,"keywords":63,"publishedAt":19},"01M79QQV7GHYR02DYGN41S23WN","xss-filter-evasion-cheat-sheet","https:\u002F\u002Fgithub.com\u002FJunMystery\u002FAgent-Guidance\u002Fblob\u002Fmain\u002Fskills\u002Fxss-filter-evasion-cheat-sheet\u002FSKILL.md",[],[],{"skillNo":65,"name":66,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":19},"01M79QQNSN7YB8XB61FFSCS3WH","xs-leaks-cheat-sheet","https:\u002F\u002Fgithub.com\u002FJunMystery\u002FAgent-Guidance\u002Fblob\u002Fmain\u002Fskills\u002Fxs-leaks-cheat-sheet\u002FSKILL.md",[],[],{"skillNo":71,"name":72,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":19},"01M79QQHZZJKFDY9132G5A65C2","xpath-injection-prevention-cheat-sheet","https:\u002F\u002Fgithub.com\u002FJunMystery\u002FAgent-Guidance\u002Fblob\u002Fmain\u002Fskills\u002Fxpath-injection-prevention-cheat-sheet\u002FSKILL.md",[],[],{"skillNo":77,"name":78,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":19},"01M79QQB9ZSD3DJG8658EHQXR1","xml-security-cheat-sheet","https:\u002F\u002Fgithub.com\u002FJunMystery\u002FAgent-Guidance\u002Fblob\u002Fmain\u002Fskills\u002Fxml-security-cheat-sheet\u002FSKILL.md",[],[],{"skillNo":83,"name":84,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":19},"01M79QQ60WKV7PFMXWT9CW8PM6","xml-external-entity-prevention-cheat-sheet","https:\u002F\u002Fgithub.com\u002FJunMystery\u002FAgent-Guidance\u002Fblob\u002Fmain\u002Fskills\u002Fxml-external-entity-prevention-cheat-sheet\u002FSKILL.md",[],[]]