Chapter 1: Buckets, Conveyors, and Magicians

Hiya! I'm Crash-tan, and I'm so excited you're here! You want to make games? Of course you do! That's why you picked up this book! And guess what? You're going to. Not someday. Not after years of studying boring computer science textbooks. Soon.

But first, we need to talk about how games actually work. Not the boring technical stuff—the fun stuff. The stuff that makes it all click in your brain like puzzle pieces snapping together.

Ready? Let's GO!


What Even IS a Game?

Okay, think about your favorite game. Any game! A platformer where you jump on mushrooms. A shooter where you blast aliens. A puzzle game where you match candies or whatever.

What do all these games have in common?

Here's the secret: every game is just three things working together, over and over, really really fast.

  1. Buckets that remember stuff (Where is the player? What's the score? Is the game over?)
  2. Conveyors that make decisions (If the player pressed jump, change their velocity! If they touched an enemy, subtract health!)
  3. Magicians that trick your eyes (Erase everything, redraw it slightly different, do it 60 times a second until your brain thinks things are moving!)

That's it. That's literally every game ever made. Store data, process logic, create illusions. Over and over, usually 60 times every single second!

Let's break each one down.


Buckets (aka Variables)

Imagine you're running a lemonade stand. (Stay with me here, this is going somewhere!)

You need to keep track of stuff, right? How much money you've made. How many cups you've sold. Whether you've run out of lemons. You could try to remember all of this in your head, but that's exhausting, and your brain has better things to do—like coming up with game ideas!

So instead, you get some buckets. Not literal buckets (although that would be fun). Mental buckets. Labeled containers where you put information.

MONEY BUCKET: $15.50
CUPS SOLD BUCKET: 23
OUT OF LEMONS BUCKET: NO

In programming, we call these buckets variables. They're just containers with names that hold stuff!

In Crash BASIC, making a bucket—er, variable—looks like this:

score = 0
playerName$ = "Crash-tan"
isGameOver = FALSE

See? Easy! You just pick a name, use the equals sign, and put something in it!

The first one, score, holds a number. The second one, playerName$, holds text (we call it a "string" because it's a string of characters—get it?). That little $ at the end is how Crash BASIC knows it's for text. The third one holds TRUE or FALSE, which is super useful for yes/no questions like "Is the game over?"

And here's the cool part: you can change what's in a bucket whenever you want!

score = 0
PRINT score       ' Shows: 0

score = score + 100
PRINT score       ' Shows: 100

score = score + 50
PRINT score       ' Shows: 150

Every time the player does something cool, you just add to the score bucket! The old number gets tossed out, and the new number takes its place.

Crash-tan's Pro Tip: Pick good names for your variables! x is fine for simple stuff, but playerHealth tells you exactly what that bucket is for, even if you look at your code six months later and have forgotten everything. Trust me on this one.


Magicians (aka Graphics)

Okay, here's where it gets FUN! And a little bit sneaky.

You know how a magician makes you believe something impossible is happening? The card wasn't really in your pocket the whole time. The assistant didn't actually get sawed in half. It's all misdirection, sleight of hand, and moving faster than your eyes can follow.

Video games are the exact same trick.

Here's the secret that blew my mind when I first learned it: nothing in a game ever actually moves. Not really. When you see Mario running across the screen, Mario isn't moving. The computer is doing something much sneakier.

It draws Mario standing still. Then it erases him. Then it draws Mario again, just a tiny bit to the right. Then erases him. Draws him again, a little more to the right. Over and over, incredibly fast—60 times per second!

Your brain sees these still images flashing by and goes, "Oh! Mario is running!" But he's not. It's an illusion. A magic trick. You're being fooled, and it's WONDERFUL.

This is the same trick movies use! Film is just a bunch of still photographs shown really fast. Games work the same way, except YOU control what happens next.

Let me show you the trick in action:

SCREEN 13
x = 0

DO
  BEGIN FRAME              ' Tell Crash BASIC: "I'm about to draw!"
  CLS                      ' Erase EVERYTHING (hide the previous drawing)
  CIRCLE (x, 100), 10, 15  ' Draw a circle at position x
  END FRAME                ' Tell Crash BASIC: "I'm done drawing!"
  x = x + 1                ' The NEXT circle will be slightly to the right
  DELAY 16                 ' Wait a tiny bit (about 60fps)
LOOP

Run this and watch a circle "glide" across the screen. But now you know the truth: that circle isn't gliding anywhere. We're just:

  1. Telling Crash BASIC we're starting to draw (BEGIN FRAME)
  2. Erasing everything (CLS = "clear screen")
  3. Drawing a NEW circle slightly to the right
  4. Telling Crash BASIC we're done (END FRAME)
  5. Repeat!

Why BEGIN FRAME and END FRAME? When you're drawing lots of things in a loop, Crash BASIC needs to know when you START drawing and when you're DONE. This lets it work much faster—it batches up all your drawing commands and shows them all at once, instead of updating the screen after every single line. Without it, your games might flicker or run slowly. Always wrap your drawing code in BEGIN FRAME / END FRAME!

The "movement" is a lie. A beautiful, wonderful lie that lets us make games!

Let's look at the basic magic spells—er, drawing commands:

SCREEN 13                        ' Set up your stage
PSET 160, 100, 4                  ' A single red dot
LINE (10, 10)-(100, 50), 14      ' A yellow line
CIRCLE (160, 100), 30, 11        ' A cyan circle
PAINT (160, 100), 11, 11         ' Fill it in!

PAUSE                            ' Wait for a keypress
  • SCREEN 13 sets up your stage (a classic 320x200 pixel canvas with 256 colors—very retro, very cool)
  • PSET puts a single pixel somewhere
  • LINE draws a line between two points
  • CIRCLE draws a circle at a position with a radius
  • The last number is always the color

These are your magic props. But remember: the real trick isn't drawing things—it's erasing and redrawing them so fast that the audience (the player) believes they're watching something move.


Conveyors (aka Logic)

So we've got buckets to store information and magicians to create illusions. But what connects them? What actually makes decisions and moves data around?

Picture a conveyor belt in a factory. Raw materials come in one end, workers at different stations do their jobs, and finished products come out the other end. Each worker has a specific task: "If this part is red, send it left. If it's blue, send it right." Simple rules, but when you chain them together, you can build something complex.

That's what logic does in your game! It's the conveyor system that takes input, makes decisions, shuffles data between buckets, and tells the magician what illusion to perform next.

Let's see it in action:

SCREEN 13

playerX = 160
playerY = 100

DO
  ' === LOOK: Check what's happening ===
  k$ = INKEY$          ' What key is the player pressing?

  ' === DECIDE: Make choices based on input ===
  IF k$ = "a" THEN playerX = playerX - 2   ' Move left!
  IF k$ = "d" THEN playerX = playerX + 2   ' Move right!
  IF k$ = "w" THEN playerY = playerY - 2   ' Move up!
  IF k$ = "s" THEN playerY = playerY + 2   ' Move down!

  ' === DRAW: Show everything on screen ===
  BEGIN FRAME
  CLS
  CIRCLE (playerX, playerY), 5, 14
  END FRAME

  DELAY 16
LOOP

This little program? It's a GAME! A tiny one, sure. But look at what's happening:

  • Buckets (playerX, playerY) store where the player is
  • Conveyors (the IF statements) make decisions: "Was 'a' pressed? Then subtract from playerX!"
  • Magicians (CLS and CIRCLE) create the illusion that a ball is moving around

The conveyor takes input from the keyboard, decides what to do with it, updates the buckets, and tells the magician what to draw. Every 16 milliseconds (about 60 times per second), the whole factory runs again. Your game is ALIVE!


Putting It All Together

Let's recap what we learned:

Buckets (Variables) store information your game needs to remember:

  • The player's position
  • The current score
  • Whether the game is paused
  • How many lives are left

Conveyors (Logic) make decisions and move data around:

  • "If the player pressed jump, set velocity to -10"
  • "If health is zero, game over"
  • "If enemy touches player, subtract a life"

Magicians (Graphics) create the illusion of a living world:

  • Nothing actually moves—we erase and redraw, 60 times per second
  • The player's brain fills in the gaps and sees motion
  • It's sleight of hand, and we're the magicians!

Every game—from Pong to the latest AAA blockbuster—uses these same three concepts. Buckets hold the state, conveyors process the logic, and magicians fool the player into seeing a world that doesn't really exist.

Pretty cool, right?


Try It Yourself!

Before moving on, try this: modify the movement example above to do something different!

Ideas:

  • Change the colors
  • Make the player leave a trail (hint: what happens if you remove the CLS?)
  • Add boundaries so the player can't go off-screen
  • Make the circle bigger or smaller based on a key press

Don't worry about breaking anything. Crash BASIC won't actually crash! That's... kind of my whole thing.

See you in Chapter 2, where we'll start building something REAL!


Next Chapter: We'll create your first actual game—complete with a goal, obstacles, and a win condition!