---
title: Getting started
description: Build and run your first tynt cartridge.
---

# Make your first cartridge

A cartridge is a TypeScript file with three exported lifecycle functions. `init()` runs once, `update()` runs at 60 Hz, and `draw()` emits the frame.

```ts title="starter.tynt"
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 <kbd>Control</kbd> + <kbd>Shift</kbd> + <kbd>Enter</kbd>. 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.

Colors are indexes from `0` to `3`: black, dark gray, light gray, and white. Coordinates are rounded to pixels and clipped to 160 × 144.

Next, browse [Examples and recipes](/docs/examples) or keep the [Cartridge API](/docs/reference/cartridge-api) nearby.
