Coding For Kids & Teens

How to Make a Snake Game in Scratch Without Lists

Most snake tutorials start by asking a nine-year-old to build a list. Store the x and y of every segment, redraw the whole body on every frame, delete the last entry when the tail should shrink. It works. It also loses most children somewhere around step four.

There is a shorter route. You can make a snake game in Scratch with two sprites, four scripts and no lists at all, because the body can be a trail of clones that delete themselves on a timer. Do it that way and the length of the tail falls out of the score for free, with no extra blocks at all.

Here is the full build, start to finish, before we take the clever part apart.

What you need before you build the snake game in Scratch

Two sprites and a backdrop. The first sprite needs two costumes, one called head and one called body, and the body costume has to be a solid green that appears nowhere else on the stage. That constraint matters later, so it is worth getting right now rather than fixing it after the collision check fails.

The second sprite is the apple. It needs a chomp sound loaded, which you add from the Sound tab.

You also need one variable, score, made for all sprites. The ready-made sprites and backdrop are linked in the video description if you would rather not draw them, and Scratch itself runs in a browser with no install.

Diagram of the Scratch snake game showing the head sprite holding three scripts and the apple sprite holding one, with the body having no sprite of its own
Four scripts, two sprites. Three of the four live on the head, including the one that becomes the body.

The head sprite: movement in nine blocks

Everything that makes the snake move sits in one script on the head sprite. Build it in this order:

  1. when green flag clicked
  2. set score to 0
  3. point in direction 0, which faces the sprite upward
  4. go to x: 0 y: 0, so every game starts in the middle
  5. switch costume to head
  6. a forever loop, and inside it the next four blocks
  7. create clone of myself
  8. move 23 steps
  9. wait 0.2 seconds

Then, still inside the forever loop and after the wait, add an if then block with the condition touching edge or touching colour green, and put stop all inside it. That block will do nothing useful until the body exists, so ignore it for now. We come back to it at the end, and it turns out to be the most interesting block in the project.

Run it. The head slides upward in little hops and stops at the top of the stage. Steps 7 to 9 are the whole engine: drop a marker, move, pause. The order is what counts. The clone is created before the move, so it lands where the head currently is rather than where it is going.

Steering: four one-line scripts

Snake does not need acceleration or momentum. It needs four directions, so it gets four tiny scripts on the head sprite, each a when key pressed hat block with a single point in direction underneath:

  • up arrow: point in direction 0
  • right arrow: point in direction 90
  • down arrow: point in direction 180
  • left arrow: point in direction -90

Nothing moves the sprite here. The forever loop is already moving it 23 steps at a time, and these four scripts only change which way it is pointing when the next move happens. Separating steering from movement like this is why the code stays short, and it is the same separation that makes a jumping game in Scratch manageable.

The apple sprite: scoring and respawning

One script, on the apple:

  1. when green flag clicked
  2. show
  3. go to x: pick random -200 to 200 y: pick random -10 to 150
  4. a forever loop containing an if touching head then block
  5. inside the if: start sound chomp
  6. then another go to x: pick random -200 to 200 y: pick random -10 to 150
  7. then change score by 1

The two random ranges are not the full stage on purpose. Capping x at 200 either side keeps apples off the edges, where the snake dies before it can reach them, and the narrower y band of -10 to 150 keeps them inside the playable area rather than behind the scoreboard. If your backdrop is different, these are the two numbers to adjust.

Note that the apple never gets eaten in any real sense. It teleports to a new random spot and the score goes up by one. There is no second apple and nothing is created or destroyed.

If your child can follow a build like this but stalls the moment something breaks, that gap is worth watching. Debugging is the part that separates children who keep building from children who quit. A free trial class with a Codeyoung teacher shows you which of the two you are looking at, before you commit to anything.

Book a Free Trial →

How to make a snake game in Scratch without a single list

The body gets no sprite of its own. It is the head, cloned, wearing a different costume. Add this second script to the head sprite:

  1. when I start as a clone
  2. switch costume to body
  3. wait ( scorex0.2 ) seconds, built by dropping a multiplication operator into the wait block, with the score variable on the left and 0.2 typed on the right
  4. delete this clone

That is the entire body. Four blocks.

Every 0.2 seconds the forever loop drops a clone at the head's current position. The clone immediately switches to the green body costume, sits still, waits, and removes itself. Because clones copy their parent's variables at the moment they are created, every clone can read the score without any extra wiring.

Why the tail is exactly as long as the score

This is the part worth slowing down for, because it is doing arithmetic most tutorials never let a child see.

The head produces one clone every 0.2 seconds. Each clone survives for score multiplied by 0.2 seconds. So the number of clones alive at any moment is the lifetime divided by the interval:

(score × 0.2) ÷ 0.2 = score

The 0.2 cancels. At a score of 6, exactly six body segments exist. At 20, exactly twenty. The tail is not stored, counted or managed anywhere, and there is no block whose job is to make the snake longer. The score variable is already the length, and the wait block simply reads it.

Chart showing Scratch snake tail length matching the score exactly, with rows of two, four, six and nine body segments as the score rises
One clone every 0.2 seconds, each living score times 0.2 seconds. The interval cancels, so segments alive always equals the score.

Two honest limits, because neither is obvious and both will bite eventually. The body is a dotted trail sampled every 23 steps rather than a continuous shape, so a fast-turning snake leaves visible gaps between segments. And Scratch caps a project at 300 clones at once, which means the tail stops lengthening at a score of 300. No child will hit that playing snake, but it is a real ceiling and it matters the moment you reuse this trick for something that spawns faster.

How the snake dies to its own body

Now go back to the block we skipped. The condition was touching edge or touching colour green, and stop all was inside it.

Touching the edge is the obvious half. The second half is the interesting one. The only green thing anywhere on the stage is the body costume, so touching colour green means touching itself. The snake's one real enemy is its own tail, and detecting that took no coordinate comparison, no loop through a list of segments, and no second variable.

Compare that with the list approach, where self-collision means walking the whole list every frame and checking the head against each stored position. Same behaviour, considerably more machinery. Choosing a colour the player can see, instead of data the player cannot, is a genuine design decision and a good one to point out while a child is building.

It is also the most common failure point in this project. If the snake dies the instant you press the green flag, the head costume contains some of the same green as the body, or the backdrop does. Change the body colour to something the stage does not use anywhere else. Teaching a child to work backwards from the symptom to the cause here is worth more than the finished game.

Make it harder, then make it yours

Change move 23 steps to move 30 steps. The snake covers more ground per hop at the same 0.2 second rhythm, which leaves wider gaps between clones and much less time to react near the edges.

Three more changes worth trying, in rising order of difficulty:

  • Lower the wait from 0.2 to 0.15 seconds in both the movement loop and the clone script. Change only one and the tail length stops matching the score, which is a useful thing to break on purpose.
  • Add a second apple worth three points, using a copy of the apple script with change score by 3. The tail now jumps three segments at a time.
  • Make the snake speed up as the score rises by replacing the fixed 0.2 wait in the movement loop with a small calculation of your own.

That last one breaks the clean cancellation from earlier, and working out why is a better lesson than the original build. If you want a second project with the same clone-and-timer shape, building Flappy Bird in Scratch reuses most of the thinking, and our Scratch classes work through this kind of mechanic one project at a time.

What this project actually teaches

Learning how to make a snake game in Scratch gets a child a working game in about twenty minutes. The part that stays with them is smaller and better hidden: a number can control time, and when you pick the right number the behaviour you wanted appears without being programmed.

Multiplying the score by 0.2 inside a wait block is a child's first encounter with a system where the rule produces the result, instead of the result being written out step by step. That idea is most of what separates copying a tutorial from designing a game, and it is easier to meet here, in four blocks, than almost anywhere else.

Codeyoung runs 1:1 live online classes for children aged 6 to 17, with a teacher who adapts the pace to your child rather than a fixed syllabus. The first class is free, so you can see how they respond before deciding.

Book a Free Trial

Scratch behaviour checked against the Scratch Wiki and scratch.mit.edu on 12 October 2026.

Frequently Asked Questions

Do you need lists to make a snake game in Scratch?
No. Lists are the common approach, but a trail of self-deleting clones does the same job with fewer blocks. Each clone waits for a length of time based on the score, then removes itself, so the tail grows without any list, index or redraw loop.
Why does the snake move in jerky steps instead of gliding?
The stop-start rhythm is deliberate. Moving 23 steps then waiting 0.2 seconds is what makes the sprite read as a snake on a grid rather than a car. A smooth glide would break the clone spacing and leave gaps in the body.
How does the snake know it has hit its own tail?
It checks for a colour, not a sprite. The body costume is green, and the only green thing on the stage is the snake itself, so a touching colour green check catches self-collision without comparing any coordinates.
What age can follow this Scratch snake tutorial?
Most children of eight and up can build it with an adult nearby to help find blocks. Children of ten and up usually finish it unaided. The multiplication inside the wait block is the one step younger builders tend to need explained.
Is there a limit to how long the snake can grow?
Yes. Scratch allows 300 clones at once, and the tail is one clone per point, so the body stops lengthening at a score of 300. No player reaches that, but it is a real ceiling worth knowing when you reuse the clone trick elsewhere.
Where do the snake and apple sprites come from?
The sprites, costumes and backdrop are prepared in advance and linked in the description of the Codeyoung video. You can also draw your own: the body costume only needs to be a solid colour that appears nowhere else on the stage.

Turn your child’s curiosity into creativity 🚀

Book a free 1:1 trial class and see how Codeyoung makes learning fun and effective.

Arpita Jain

Arpita Jain
I head curriculum design for Codeyoung's coding program. For the last 10+ years, I've built K-12 computer science curricula, and today I oversee the Scratch-through-Python pathway that thousands of Codeyoung kids learn on. The question I care about most is the one every parent eventually asks: what should my kid actually be learning at each age, and in what order? Too much kids' coding rushes children into typing real code before they're ready — and they bounce off it. I built our age-banded curriculum to do the opposite: logic and confidence first, with visual block coding, then real syntax once a child is genuinely ready for it.

Codeyoung Perspectives

Codeyoung Perspectives is a thought space where educators, parents, and innovators explore ideas shaping how children learn in the digital age. From coding and creativity to strong foundational math, critical thinking and future skills, we share insights, stories, and expert opinions to inspire better learning experiences for every child.