pixel-perfect
Phaser v4 destructible terrain & pixel-perfect collision. Demo sandbox — open one to verify the library does what it says, or pull a demo apart to learn the API.
-
01basic rendering
live
Procedural terrain painted from a `ChunkedBitmap` into canvas-backed Phaser textures. No interaction, no physics — just verifies the rendering pipeline.
-
02click to carve
live
Left-click to carve, right-click to deposit, wheel to resize the brush, R to regenerate the terrain. Watch the chunk repaint counter rise on each edit.
-
03physics colliders
live
Same as 02 plus a Box2D world. Space to spawn balls, D to toggle a green-line collider debug overlay, watch balls land on the carved shape in real time.
-
04falling debris
live
Three shelves on thin necks. Carve the neck and the shelf detaches — DebrisDetector finds the new island, the queue bodies it, and gravity does the rest.
-
05pixel-perfect sprite
live
Drag a circle sprite onto a ring sprite; AABBs overlap (yellow) but solid pixels only collide when the inner edges touch (green). Same test runs against a small destructible terrain patch in the bottom-left.
-
06worms-style
live
Trailer piece. Walk a small circle character across a wide hilly bitmap with arrows / WASD; F throws fused grenades that carve craters and detach cliff slabs as falling debris. End-to-end exercise of the per-chunk collider model under continuous interaction.
-
07image-based terrain
live
Stamp an alpha mask onto the bitmap to build terrain from any PNG / canvas. Two materials extracted from the same image at different alpha thresholds — sand outline, dirt core. Click to carve the result.
-
08sprite playground
live
Drag-and-test sandbox for `PixelPerfectSprite`. Drop your own PNG to swap the sprite's texture; cyan outline traces the alpha mask the collision math actually uses. AABB / pixel-perfect overlap colored against another sprite + a terrain patch.
-
09falling sand sandbox
live
Five fluid kinds (sand · water · oil · gas · fire) with density-ranked swaps and multi-cell flow. Oil floats on water; gas bubbles up; fire walks a wooden plank and burns it to air. Sand still settles to a static variant after ~½ s — press B to drop a Box2D ball onto the resulting pile.