Make your first cartridge
A cartridge is a TypeScript file with three exported lifecycle functions. init() runs once, then tynt targets 60 fixed updates per second, each followed by draw(). Slow devices may run fewer updates; tynt keeps catch-up bounded and never queues multiple worker ticks.
Use New in the editor toolbar to begin with a Blank, Arcade, Platformer, Puzzle, or Top-down scaffold. Templates are deliberately small and ready to change. Choosing one replaces the current editor draft, so save or export anything you want to keep as a separate copy first.
let x = 76;
export function init(): void {
clear(0);
}
export function update(): void {
if (button("left")) x = Math.max(0, x - 1);
if (button("right")) x = Math.min(152, x + 1);
}
export function draw(): void {
clear(0);
rect(x, 68, 8, 8, 3, true);
text("tynt", 72, 82, 2);
}Press Run or Control + Shift + Enter. The preview receives focus automatically. Use arrow keys to move, Z for A, and X for B. The on-screen controls work the same way.
A standard gamepad also works in the editor preview and on game pages. Use its D-pad or left stick for directions, the bottom face button for A, and the right face button for B. Press a controller button if the browser has not detected it yet. The gamepad icon beside Show controls is always visible; hover or focus it to see whether a standard gamepad is connected. Keyboard, on-screen controls, and gamepad input can be used together. Controllers without the standard browser mapping are not supported yet.
Colors are indexes from 0 to 3: black, dark gray, light gray, and white. Coordinates are rounded to pixels and clipped to 160 × 144.
Open Debugger below the editor preview when you need to inspect a game. It shows the current frame and input state, and lets you pause, advance one update, resume, restart, or download a 2× PNG screenshot. Frame stepping is available only while a cartridge is paused.
Pause preserves both the last visible frame and the game's state. Resume continues the same run; Restart starts again from init(). A hidden tab automatically pauses gameplay and audio, then resumes on return unless you had paused it manually. Leaving the page stops the worker and disposes its audio resources.
Public games are compiled when the gallery is built, so playing them does not download the browser TypeScript compiler. Local cartridges and editor changes compile in the browser. If a compiler download fails, try Run again; if a public game fails to download, try Restart. Neither requires a page reload. Audio device or autoplay failures do not stop the game.
Next, browse Examples and recipes or keep the Cartridge API nearby.