~1 min read

Examples

Runnable Phaser 4 examples — each one is a sandboxed playground you can read, fork, and modify.

Every example here runs in a sandboxed iframe with a pinned Phaser 4 build. The source on the page is the exact source being executed — there’s no hidden setup.

Starter examples

  • Basic sprite — load a texture and draw it.
  • Keyboard movement — WASD / arrows moving a sprite, polling style with delta-time velocity.
  • Scene transition — fade between two scenes using the camera fade API.
  • Tween chain — chain a sequence of tween effects on a single target.
  • Collision response — click to drop physics balls that collide with each other and the world bounds.
  • Particle burst — click anywhere to fire a one-shot explosion using the emitter’s explode mode.
  • Physics overlap (pickups) — walk into stars to collect them; the canonical overlap-as-trigger pattern.
  • Shader filter (Bloom) — built-in Bloom filter on a sprite with strength animated by a tween.

More are still wanted — tilemap loading, gamepad input, save/load via a global plugin, a custom GLSL Shader game object. If you have a working example that demonstrates something the existing guides only describe, open a PR.

Authoring an example

Examples live under src/content/docs/examples/ as .mdx files. They import the Playground component and pass it a single code string. See basic-sprite.mdx for the smallest working template.