All examples · Scenes · As Markdown, for AIs

First scene

What this example shows

The anatomy of every scene, spread across files. index.ts creates the game with the scenes it knows, by name. scenes/demo.ts is the scene: a function that runs once. And components/player.ts is the player.

The scene creates the player with useSpawn(Player)(). The player has its own object: its sprite and useUpdate belong to it, and the scene composes that object. settings.ts holds the dimensions and speed. A game is built this way, from small pieces that can move from one file to another.

Starting
Starting
—