Install any skill in seconds. Free to start, no credit card required.
Get Started Free →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+
.claude/skills/jame581-2d-essentials/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 69% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 61% | 0% |
| case-04 | ✗→✓ | ▲ Improved | 49% | 0% |
| case-14 | ✗→✓ | ▲ Improved | 87% | 0% |
| case-03 | ✓→✓ | = Same ✓ | 152% | 0% |
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.
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.
gdscript# Draw this node above siblings (default z_index is 0) z_index = 10 # Make z_index relative to parent (default: false = global) z_as_relative = true
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
├── 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_index or scene tree ordering. CanvasLayers are for elements that should be independent of the camera (HUD, parallax, transitions).
Camera2D works by modifying the viewport's canvas_transform. For manual control:
gdscript# Scroll the canvas directly (equivalent to camera movement) get_viewport().canvas_transform = Transform2D(0, Vector2(-200, 0))
gdscript# Local to canvas (world) coordinates var world_pos: Vector2 = get_global_transform() * local_pos var local_pos: Vector2 = get_global_transform().affine_inverse() * world_pos # Local to screen coordinates (accounts for camera, stretch, window) var screen_pos: Vector2 = get_viewport().get_screen_transform() * get_global_transform_with_canvas() * local_pos
csharp// Local to canvas (world) coordinates Vector2 worldPos = GetGlobalTransform() * localPos; Vector2 localFromWorld = GetGlobalTransform().AffineInverse() * worldPos; // Local to screen coordinates Vector2 screenPos = GetViewport().GetScreenTransform() * GetGlobalTransformWithCanvas() * localPos;
TileMapLayer (Godot 4.5+) is the modern API — one tilemap = one node = one layer. Drive painting with a TileSet resource (atlas + properties + physics + custom data). Use terrain autotiling for biome-aware tile selection, scene collection tiles for placing scene instances on tiles.
> See references/tilemap.md for full TileSet setup, atlas / physics / terrain configuration, custom data on tiles, scene collection tiles, and the 4.5+ tile-collision-bump auto-merge fix.
Parallax2D (Godot 4.4+) replaces the older ParallaxBackground/ParallaxLayer pair. Set scroll_scale per layer (0 = static, 1 = follows camera 1:1, fractional values for depth). Add repeat_size for infinite tiling.
> See references/parallax.md for Parallax2D setup, side-scroller layer example, infinite repeat, split-screen parallax, common mistakes.
PointLight2D and DirectionalLight2D cast lighting onto sprites — pair with a normal map for 3D-style shading or use additive-blend illumination on flat sprites. Cast shadows with LightOccluder2D.
> See references/lights-and-shadows.md for node overview, PointLight2D properties, shadow settings, cull masks, occluders, 2D normal maps, pixel-art lighting tips, and additive-sprite fake-light tricks.
GPUParticles2D for high counts (≥ 50 particles, GPU-driven), CPUParticles2D for low counts or platforms without GPU support. Both share the same ParticleProcessMaterial interface; differences are mainly performance.
> See references/2d-particles.md for the GPU-vs-CPU distinguishing choices, basic setup, ParticleProcessMaterial 2D properties, emission from textures, flipbook, visibility rect, common 2D recipes.
Override _draw() on any CanvasItem to draw lines, polygons, text, or arbitrary shapes. Call queue_redraw() to trigger a re-render (never call _draw() directly).
> See references/custom-drawing.md for the _draw() method, redrawing patterns, full drawing-methods reference, default font usage, @tool editor preview, line-width gotchas.
> Godot 4.7+: DrawableTexture2D — a runtime-drawable texture type — shipped experimental in 4.7 and is not yet recommended for production.
MeshInstance2D replaces Sprite2D when large transparent areas waste GPU fill rate. The GPU draws the entire texture quad including fully transparent pixels — a mesh eliminates those.
Sprite2DBest candidates:
Many drawing methods support an antialiased parameter:
gdscriptdraw_line(Vector2.ZERO, Vector2(100, 50), Color.WHITE, 2.0, true) # antialiased = true
csharp// Equivalent in a CanvasItem subclass (e.g., a custom Control or Node2D): public override void _Draw() { DrawLine(new Vector2(0, 0), new Vector2(100, 50), Colors.White, width: 2.0f, antialiased: true); }
Line2D has an Antialiased property in the inspector — set it via line2D.Antialiased = true in C# or as an Inspector toggle in the editor. This works by generating additional geometry — no MSAA needed.
> ⚠️ Changed in Godot 4.7: CanvasItem antialiased line drawing no longer adds the antialiasing feather. The feather made draw_line()-style lines appear thicker than intended, so antialiased lines render thinner after upgrading — projects that relied on the old look must draw a thicker width. See the 4.7 migration guide.
Available in Forward+ and Mobile renderers only (NOT Compatibility).
Project Settings → Rendering → Anti Aliasing → Quality → MSAA 2D
Levels: 2x, 4x, 8x.
| MSAA affects | MSAA does NOT affect | |-------------|---------------------| | Geometry edges (lines, polygons) | Aliasing within nearest-neighbor textures | | Sprite edges touching texture edges | Custom 2D shader output | | | Font rendering | | | Specular aliasing with Light2D |
> For pixel art: Do NOT enable MSAA 2D — it blurs intentionally sharp edges. Use the per-node antialiased parameter selectively.
Three-dot menu in the 2D toolbar:
For pixel-art games, enable pixel snapping to prevent subpixel jitter:
Snap 2D Transforms to PixelSnap 2D Vertices to PixelSnap Controls to Pixels.tres resource for reuse across levelsUse Texture Padding enabled to prevent texture bleedingrepeat_size matches actual texture dimensionsrepeat_times is increased if the camera can zoom outqueue_redraw() is called when custom drawing state changes| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→pass | 13,670 | 10,405 | -24% | 1 | 1 | 0% | 2,576 | 4,359 | +69% | 0 | 0 | — |
case-02 | fail→pass | 15,163 | 11,322 | -25% | 1 | 1 | 0% | 2,663 | 4,280 | +61% | 0 | 0 | — |
case-03 | pass→pass | 8,191 | 6,351 | -22% | 1 | 1 | 0% | 1,434 | 3,616 | +152% | 0 | 0 | — |
case-04 | fail→pass | 11,448 | 3,179 | -72% | 1 | 1 | 0% | 1,966 | 2,933 | +49% | 0 | 0 | — |
case-05 | pass→pass | 7,371 | 4,337 | -41% | 1 | 1 | 0% | 1,396 | 3,278 | +135% | 0 | 0 | — |
case-06 | pass→pass | 4,435 | 2,649 | -40% | 1 | 1 | 0% | 794 | 2,897 | +265% | 0 | 0 | — |
case-19 | pass→pass | 13,199 | 4,596 | -65% | 1 | 1 | 0% | 2,137 | 3,201 | +50% | 0 | 0 | — |
case-07 | pass→pass | 3,814 | 3,064 | -20% | 1 | 1 | 0% | 606 | 2,973 | +391% | 0 | 0 | — |
case-08 | pass→pass | 4,006 | 2,147 | -46% | 1 | 1 | 0% | 712 | 2,785 | +291% | 0 | 0 | — |
case-09 | pass→pass | 10,998 | 5,087 | -54% | 1 | 1 | 0% | 2,010 | 3,364 | +67% | 0 | 0 | — |
case-10 | pass→pass | 11,667 | 9,696 | -17% | 1 | 1 | 0% | 2,079 | 4,068 | +96% | 0 | 0 | — |
case-11 | pass→pass | 9,987 | 5,332 | -47% | 1 | 1 | 0% | 1,726 | 3,415 | +98% | 0 | 0 | — |
case-12 | pass→pass | 7,240 | 5,545 | -23% | 1 | 1 | 0% | 1,280 | 3,457 | +170% | 0 | 0 | — |
case-13 | pass→pass | 6,772 | 5,258 | -22% | 1 | 1 | 0% | 1,198 | 3,335 | +178% | 0 | 0 | — |
case-14 | fail→pass | 13,783 | 9,847 | -29% | 1 | 1 | 0% | 2,364 | 4,417 | +87% | 0 | 0 | — |
case-15 | pass→pass | 11,817 | 5,844 | -51% | 1 | 1 | 0% | 2,081 | 3,498 | +68% | 0 | 0 | — |
case-16 | pass→pass | 12,433 | 6,828 | -45% | 1 | 1 | 0% | 2,070 | 3,517 | +70% | 0 | 0 | — |
case-17 | pass→pass | 9,010 | 8,245 | -8% | 1 | 1 | 0% | 1,518 | 3,887 | +156% | 0 | 0 | — |
case-18 | pass→pass | 10,260 | 9,033 | -12% | 1 | 1 | 0% | 1,674 | 4,047 | +142% | 0 | 0 | — |
case-20 | pass→pass | 12,405 | 11,161 | -10% | 1 | 1 | 0% | 2,242 | 4,615 | +106% | 0 | 0 | — |
case-21 | pass→pass | 17,113 | 19,988 | +17% | 1 | 1 | 0% | 3,097 | 6,328 | +104% | 0 | 0 | — |
case-22 | pass→pass | 7,461 | 8,736 | +17% | 1 | 1 | 0% | 1,318 | 4,033 | +206% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +18 percentage points is the difference between those two pass rates over the 22 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.