2d Essentials
Use when working with 2D-specific systems, TileMaps, parallax scrolling, 2D lights and...
Install
npx skills add jame581/GodotPrompter --skill 2d-essentials -g -a claude-code -y- Repository
- jame581/GodotPrompter914
- Category
- Engineering
- Updated
- 3d ago
- License
- MIT
- Context cost
- Mediumabout 2,311 tokens
- Runs scripts
- No, instructions only
What it does
Use when working with 2D-specific systems, TileMaps, parallax scrolling, 2D lights and shadows, canvas layers, particles 2D, custom drawing, and 2D meshes in Godot 4.3+
2D Essentials in Godot 4.3+
All examples target Godot 4.3+ with no deprecated APIs. GDScript is shown first, then C#.
Related skills: player-controller for CharacterBody2D movement patterns, animation-system for AnimatedSprite2D and sprite animation, physics-system for collision shapes and raycasting, camera-system for Camera2D follow and shake, shader-basics for 2D shaders and post-processing, godot-optimization for rendering and draw call tuning.
1. Canvas Layers and Draw Order
Draw Order Rules
Within a single canvas layer, nodes draw in scene tree order, nodes listed lower in the Scene panel draw on top. Use z_index to override without rearranging the tree.
# Draw this node above siblings (default z_index is 0)
z_index = 10
# z_index is relative to the parent by default (z_as_relative = true);
# set it false to make this node's z_index absolute
z_as_relative = false
CanvasLayer
CanvasLayer creates a separate rendering layer with its own transform, independent of the camera. Higher layer values draw on top.
| Layer | Typical Use |
|---|---|
| -1 | Parallax backgrounds |
| 0 | Default game layer (all Node2D without CanvasLayer) |
| 1 | HUD / UI overlay |
| 2 | Pause menu, screen transitions |
# Scene tree example
Main
├── ParallaxBackground (CanvasLayer, layer = -1)
│ └── Parallax2D (follow_viewport = false, the layer doesn't follow the camera)
├── World (Node2D, default layer 0)
│ ├── TileMapLayer
│ └── Player
└── HUD (CanvasLayer, layer = 1)
└── Control
Note: CanvasLayers are NOT required to control draw order. For objects within the same game world, use
z_indexor scene tree ordering. CanvasLayers are for elements that should be independent of the camera (HUD, parallax, transitions).
Canvas Transform
Camera2D works by modifying the viewport's canvas_transform. For manual control:
