Skip to main content

Stage 3: Ground and First Spikes

Stage 3: Ground and First Spikes

Course progressStage 3 of 10
~90 min
Your workspace

Keep your Scratch project tab open all week. Open in a new tab so you don’t leave the course.

Build

a floor line, a spike obstacle, and crash detection

Learn

how touching detection creates danger

Ship

the first real fail condition

Teacher demo
  1. Paint a Ground sprite as a long rectangle near the bottom of the stage.
  2. Paint a Spike sprite as a triangle and place it on the floor.
  3. Show the cube touching the spike and switching gameOn to 0.
  4. Add a short crash sound or color flash if students want one.

The big idea

A platformer needs safe space and danger space. The floor is safe. The spike is danger. Collision detection decides which one the cube is touching.

New words
collision
when two sprites touch each other
obstacle
something the player must avoid
hitbox
the invisible touching area Scratch uses for a sprite
fail state
the game state after the player crashes
Before you start

Stage 2 should be done. The cube can jump and land.

Use the examples

Follow the target shapes shown here so your scripts match the lesson quickly.

Make your own

Draw a custom cube, spikes, portal, or backdrop in Scratch. Keep the same sprite names so the code still works.

Finished game target
Cube runnerSpike obstacle

The cube stays near the left side while the level scrolls toward it. Jump timing is the whole game.

Build it

  1. Paint a Ground sprite. A simple bright rectangle is enough.
  2. Paint a Spike sprite. Use a clean triangle with a thick outline.
  3. Place Spike at x: 120 y: -100 so it sits on the floor.
  4. Add the crash checker to the Cube sprite.
  5. Playtest by dragging the spike under the cube, then by jumping over it.

Crash checker

forever
if <<touching [Spike v] ?> and <(gameOn) = (1)>> then
set [gameOn v] to (0)
say [Crash!] for (1) seconds
end
end

Understand it

The spike does not need to know it is dangerous. The Cube checks for touching and decides what happens. That keeps the player's rules in one place.

Try this

Learning beat

Try this

Three short experiments. Predict before you run, then test your guess.

Predict first
Make the spike costume wider. Predict whether the cube crashes sooner.
Compare
Try a sharp triangle and a rounded triangle. Which one feels fairer?
Connect
Stage 4 moves the spike. Which direction should it move if the cube stays on the left?

Test your stage

  • Ground is visible near the bottom of the stage.
  • Spike is named Spike exactly.
  • Touching Spike sets gameOn to 0.
  • A clean jump can clear the spike.

If it breaks

  • If crashes never happen, check the sprite name in the touching dropdown.
  • If crashes happen too early, edit the costume so empty transparent space is removed.
Coach notes

Keep students moving on the default path first. Custom assets are encouraged, but the required names and variables are not optional. If debugging takes more than a few minutes, compare the student's sprite names, variable names, and block order against the stage test list.