Skip to content

77 game-dev skills for AI coding agents — Godot, Unity, Unreal, Phaser, PixiJS, three.js, Bevy, pygame, LÖVE, Roblox. Portable SKILL.md Agent Skills (the format Anthropic launched as Claude Skills), with a router that loads the right skill for your engine and task. Runs in Claude Code, Cursor, Kiro, Codex, Copilot, Gemini CLI and more.

fix(phaser): correct scene launch/run and draw-order guidance, add v4 migration pitfalls

Kiro Crew0882aa9cf59e
diff --git a/skills/web-engines/phaser-core/SKILL.md b/skills/web-engines/phaser-core/SKILL.md
index 5c4ddbd..a8d853b 100644
--- a/skills/web-engines/phaser-core/SKILL.md
+++ b/skills/web-engines/phaser-core/SKILL.md
@@ -128,7 +128,9 @@ ui.events.emit('show-message', 'Level cleared!');
```js
this.scene.start('gameover', { score: this.score }); // stop this scene, start target
-this.scene.launch('hud'); // run a second scene in parallel (overlay HUD)
+this.scene.launch('hud'); // run a second scene in parallel (restarts it if already running)
+this.scene.run('hud'); // wake if sleeping, resume if paused, else (re)start
+this.scene.bringToTop('hud'); // draw order follows the scene list, not launch order
this.scene.switch('menu'); // sleep this scene, start/wake target
this.scene.pause(); // freeze updates but keep rendering (modal)
this.scene.sleep(); // stop updating AND rendering, keep state for wake
@@ -150,6 +152,13 @@ this.cameras.main.setZoom(1.5);
instance is reused; reset run state in `init()` and clear arrays on `shutdown`.
- **`this.scene.start` vs `this.scene.launch`** → `start` stops the calling scene;
`launch` runs the target alongside it. Using `start` for a HUD hides the game.
+- **HUD loses its state or draws behind the game** → `launch` (and `run`) on a scene
+ that is already running shuts it down and starts it again; launch the HUD once, or
+ guard with `if (!this.scene.isActive('hud'))`. Scenes draw in scene-list order, so a
+ HUD listed before the gameplay scene renders underneath it until you call
+ `this.scene.bringToTop('hud')`.
+- **Scene state read right after `start`/`launch` is stale** → scene operations are
+ queued and run at the start of the next game step, not synchronously.
- **`this` is wrong in a callback** → arrow functions keep the Scene's `this`; plain
`function` callbacks need a context argument or `.bind(this)`.
- **Phaser 2 tutorials don't work** → "States" were renamed to "Scenes" in Phaser 3,
@@ -158,6 +167,16 @@ this.cameras.main.setZoom(1.5);
- **Phaser 3 custom pipelines fail in Phaser 4** → Phaser 4 rebuilt the renderer and
replaced the old FX/pipeline extension points. Migrate custom shaders and renderer
plugins against the Phaser 4 guide; do not mechanically copy internal renderer code.
+- **A Phaser 3 snippet runs but looks wrong in Phaser 4** → common renames: `preFX`/
+ `postFX` and `BitmapMask` became filters (`obj.enableFilters()` then
+ `obj.filters.internal`/`.external`); `setPipeline('Light2D')` became
+ `setLighting(true)`; `setTintFill(c)` only logs an error, so use
+ `setTint(c).setTintMode(Phaser.TintModes.FILL)`; `Phaser.Math.TAU` is now 2π (use
+ `Phaser.Math.PI_OVER_2` where v3 code meant π/2); `Geom.Point` is gone (use
+ `Phaser.Math.Vector2`). Canvas rendering still works but is deprecated.
+- **Pixel art is blurry or shimmers while moving** → set `pixelArt: true` in the game
+ config. It turns off antialiasing and turns on `roundPixels`, which defaults to
+ `false` in Phaser 4.
- **Nothing renders / black screen** → confirm the canvas mounted, `width`/`height`
are set, and a scene actually started (check `game.scene.dump()` output).
diff --git a/skills/web-engines/phaser-core/references/scene-flow.md b/skills/web-engines/phaser-core/references/scene-flow.md
index 574f8ef..e489d7a 100644
--- a/skills/web-engines/phaser-core/references/scene-flow.md
+++ b/skills/web-engines/phaser-core/references/scene-flow.md
@@ -26,18 +26,25 @@ The same `data` object is passed to `init` and `create`, coming from
| Method | Effect on target | Effect on caller |
|--------|------------------|------------------|
| `start(key, data)` | start (or restart) | **stop** the caller |
-| `launch(key, data)` | start in parallel | caller keeps running |
-| `switch(key)` | start or wake | **sleep** the caller |
+| `launch(key, data)` | start in parallel; **restarts** it if already running | caller keeps running |
+| `run(key, data)` | wake if sleeping, resume if paused, otherwise (re)start | caller keeps running |
+| `switch(key)` | wake if sleeping, otherwise start (a paused target restarts) | **sleep** the caller |
| `pause(key?)` | stop updating, keep rendering | — |
| `resume(key?)` | resume updating | — |
| `sleep(key?)` | stop updating AND rendering, keep state | — |
| `wake(key?)` | resume a sleeping scene | — |
| `stop(key?)` | shutdown (frees objects) | — |
+All of these are queued: the Scene Manager applies them at the start of the next game
+step, so the target scene has not started yet on the line after `start`/`launch`.
+
Rules of thumb:
-- **HUD/overlay** → `launch` it once; it renders on top because later scenes draw
- later. Toggle with `setVisible()` or `sleep`/`wake`, not `start`.
+- **HUD/overlay** → `launch` it once; a second `launch` or `run` while it is running
+ restarts it, so guard with `this.scene.isActive('hud')`. Scenes draw in scene-list
+ order, so it is on top only if it comes after the gameplay scene in the `scene`
+ config array; otherwise call `this.scene.bringToTop('hud')`. Toggle with
+ `setVisible()` or `sleep`/`wake`, not `start`.
- **Modal pause menu** → `pause` the gameplay scene and `launch` the menu; `resume`
on close.
- **Title ⇄ gameplay you revisit** → prefer `sleep`/`wake` (state preserved, starts