flip-phaser-starter
Installation
SKILL.md
Flip: Phaser Starter
Flip recommends Phaser 4.2.1 for 2D. Run flip init --template phaser --dir NEW_DIR (Star Drop). Read the starter's AGENTS.md first.
- Import
* as Phaser from './flip-phaser-4.2.1.js'. Flip serves it with its core beside the game. Never commit Phaser, use a CDN orimport 'phaser'. Write Phaser 4 APIs. - The sandboxed frame needs
input: { windowEvents: false }andloader: { imageLoadType: 'HTMLImageElement', crossOrigin: 'anonymous' }. - Script, plugin and scene-file loaders and DOMElement HTML are disabled (
ENGINE_FEATURE_DISABLED). Load images, atlases, audio and JSON only. - Controls: Flip's page owns the gamepad and streams
flip.on('input')events. The starter'spad.jsturns them into per-frame presses:pad.attach(flip)once, thenpad.poll()inupdate(). Map the stick or D-pad to movement andprimaryormenuto the main action. Never callnavigator.getGamepads(). Callthis.sound.unlock()inflip.on('audioUnlock', …). - Test bridge:
setSeed(n)callsgame.loop.sleep()andPhaser.Math.RND.sow([String(n)]).reset()sleeps the loop, restores the view and callsscene.restart().step(ms)callsgame.step(t += ms, ms).snapshot()returns the view plus key sprite positions. Two seeded runs should give identical JSON for repeatable browser tests; inconsistent results only warn. - Call
signalStart()only once the scene exists and the SDK is connected (markPlayablein the starter). - Decoration may use
Phaser.Math.RND; outcomes come fromgame.server.jsviactx.sdk.requestRandomness. - Text drawn on the canvas cannot satisfy
assertText; mirror important state in DOM text orsnapshot()and assert it withassertState.
Guide: https://flip-sdk-proposal.vercel.app/sdk/guides/phaser.md