Pico-8 Cookbook
Pico-8 Code Recipes
Realising that some people are still using this guide I've tried to update it with revised and new content that may be of interest and use.
My Pico-8 Code Examples
Graphics
- Sprite Help & Sprite Flags
- Animation Example
- Palette Tricks — recolouring sprites, transparency, screen fades
- Map From Array
Movement
- Directions Example
- Movement Example
- Movement Inertia — acceleration, friction, sliding feel
- Camera & Scrolling Map — including smooth follow
- Jumping & Falling
- Falling Example
- Gravity — falling objects, arcing projectiles
- Adjacency Example & PrintH Function
Collision
- Collision Types — pixel colour, tile flag, point–point
- Box Collision
- Wall Collision - Basic & Function
- Bouncing — velocity flip, damping, gravity
- Projectiles — firing, collision, 8-direction, arcs
- Picking Up Items — item tables, overlap, drops
- Ladder Climbing
Game Structure
- Game States — title / play / game over pattern
- Timers & Cooldowns — countdowns, rate limiting, repeating intervals
- Coroutines — cutscenes, timed sequences, dialogue without blocking
Enemies
- Enemy AI — patrol, chase, attack states
- Health & Damage — HP, invincibility frames, knockback, death
- Spawning Waves — timed, wave-based, escalating difficulty
UI
- HUD — score, lives, timer, health bar
- Dialogue — text box with typewriter reveal and multi-line advance
Arrays & Data
- Array Example
- Rooms Array Example
- Save Data — persistent saves with CARTDATA / DGET / DSET