Skip to content


Scratch hungry dino

Beginner | Scratch | Accelerometer, LED display | Selection, Sensors, Variables

Step 1: Make it

What is it?

Learn how to make a wireless game controller with your micro:bit and Scratch - and help feed tacos to your dinosaur!

Screenshot of Scratch game where a dinosaur has to eat tacos and avoid bugs

How it works

  • To play the game, connect your micro:bit to Scratch, then tilt it to move the dinosaur to catch and eat tacos.
  • Every time the dinosaur touches a taco the points variable increases by 1.
  • Avoid the bugs – touch them and the points variable is reduced by 1.
  • The program uses the micro:bit’s accelerometer input readings to sense which way you tilt it.
  • It then uses selection to decide what happens next: if you tilt it to the front or back it moves the dinosaur sprite up and down (in the Y-axis).
  • If you tilt it left and right it moves the dinosaur across the screen in the X-axis.
  • The program also sends your score to the micro:bit so it appears on its LED display output.

What you need

  • micro:bit and optional battery pack
  • suitable computer with Scratch link installed. See for details on how to get Scratch working with micro:bit

Step 2: Code it

Scratch blocks for the dinosaur sprite

Blocks for the dinosaur sprite

Scratch code blocks for the taco sprite

Code blocks for the taco sprite

Scratch code blocks for the ladybug (ladybird) sprite

Code blocks for the ladybug (ladybird) sprite

Step 3: Improve it

  • Add a winning or losing score to end the game.
  • Add more bugs or tacos or other goodies and baddies.
  • Add levels to the game to make it harder as you progress.