Skip to content

Before you start

Three projects, in order. Each one builds and runs — every listing on these pages has been compiled with the current compiler, so if a build fails it is a typo, not the tutorial.

# Project Teaches
1 Draw a square sprites, handlers, for, procedures, pen
2 A clicking game globals, switch, broadcasts, two sprites
3 Falling treats clones, lists, parallel scripts, game state
Terminal window
katnip build game.knip # writes game.sb3

Then drag game.sb3 onto TurboWarp and click the flag. When you change the source, rebuild and drag it in again.

katnip check game.knip is the faster loop when you just want to know whether it type-checks — it skips codegen entirely.

Every sprite has the same default costume. Katnip does not import assets, so all your sprites are the Scratch cat until you add costumes by hand in the editor. Position, size and colour are all you have to tell them apart. Plan visuals accordingly, or add costumes after building.

Some things type-check and then fail to build. console.log is the one you will hit first — it appears in older examples and does not compile. Skim Known gaps once before you start; it is short, and it will save you a confusing half hour.

Ready? Start with the square.