본문으로 건너뛰기
cccskills
무료GitHub에 공개

godot-tilemap

Build tile-based 2D levels in Godot 4.7 using TileMapLayer and TileSet. Configure collision and tile properties, connect terrain tiles automatically, edit cells during gameplay, and migrate older TileMap scenes to the layer-based structure.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

원문원문 설명 보기

Build and edit tile-based 2D levels in Godot 4.7 with TileMapLayer and TileSet: paint layers, set up collision/navigation/custom-data on tiles, autotile with terrain sets, and read/write 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.

실행 점수 미검증

설치 방법 보기

이럴 때 유용합니다

  • Building layered 2D tile maps
  • Setting collision and per-tile properties
  • Automatically connecting terrain edges and corners
  • Placing and removing tiles during gameplay
  • Migrating TileMap scenes to TileMapLayer

포함된 파일(2)

  • SKILL.md5.9 KB
  • references/tileset-and-terrains.md4.0 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Godot TileMap (4.7 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.7, 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:
        # event.position is in viewport pixels and ignores Camera2D scroll/zoom.
        # make_input_local() converts it into this layer's local space.
        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")  # 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 layer-local coordinates. A world position needs to_local(...) first. A mouse event's position is in viewport pixels, not world space, so it is wrong as soon as a Camera2D scrolls or zooms; convert it with make_input_local(event) (or poll get_local_mouse_position()) instead.
  • 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.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Implement reusable decision systems for game characters using behavior trees, which organize conditional actions, and Utility AI, which scores available choices. Build either approach or combine them to control patrols, combat, targeting, and needs-based behavior.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Build a reusable behavior tree runtime
  • Choose attacks or targets using action scores
  • Combine patrol and combat trees with Utility AI
gamedev-skills/awesome-gamedev-agent-skills3.9천2026년 10월 24일 업데이트

Design game audio with grouped volume controls, music that responds to gameplay, and varied sound effects. Plan how music lowers during dialogue and how events follow the beat, using principles that can be adapted to different game engines.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Plan grouped volume controls for music, effects, and dialogue
  • Lower background music while dialogue plays
  • Change music layers or segments with gameplay intensity
gamedev-skills/awesome-gamedev-agent-skills3.9천2026년 10월 24일 업데이트

bevy-ecs

무료

Build and debug Rust games in Bevy using ECS, a way to separate game data from behavior. Organize apps and plugins, query entities, control execution order, and fix conflicting data access or frame-dependent movement.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Organizing a Bevy app with plugins
  • Defining components and shared resources
  • Fixing conflicting queries and execution order
gamedev-skills/awesome-gamedev-agent-skills3.9천2026년 10월 24일 업데이트

Build and tune game cameras for smooth 2D following and 3D viewing. Covers motion smoothing, look-ahead, level boundaries, wall avoidance, and framing multiple targets, with techniques that apply across engines.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Smooth player-follow cameras in 2D games
  • Keep the camera view within level boundaries
  • Prevent third-person cameras from clipping through walls
gamedev-skills/awesome-gamedev-agent-skills3.9천2026년 10월 24일 업데이트

card-game

무료

Design the core rules of a card game, including decks, hands, discards, drawing, shuffling, turns, and resource costs. Represent card effects as data and define their resolution order so card movement and gameplay outcomes follow explicit rules.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Building a deckbuilder or trading card game
  • Implementing draws and discard reshuffling
  • Defining turn phases and card costs
gamedev-skills/awesome-gamedev-agent-skills3.9천2026년 10월 24일 업데이트

Plan and prepare consistent game artwork, from sprites and backgrounds to UI icons and 3D briefs. Organize asset requirements, generate or source related visuals, standardize files, and check their appearance and technical fit inside the game.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Create sprites and backgrounds with a consistent visual style
  • Check asset dimensions, transparency, and tile seams
  • Track asset sources and licenses before release
gamedev-skills/awesome-gamedev-agent-skills3.9천2026년 10월 24일 업데이트

gamedev-skills의 스킬 모두 보기

이 스킬의 문제 신고