Code Adventure Free Scratch Coding Activity

Screenshot of a code adventure Scratch game showing a small hero character trying to sneak past two goblin guards toward a glowing key outside a castle.

We’ve put together a step-by-step guide for children to have a go at coding their own RPG Adventure game in Scratch.

  1. 1

    Go to the Scratch website: https://scratch.mit.edu/

  2. 2

    Sign in or register for Scratch

    If you already have a Scratch account, click ‘Sign in’ and enter your login details. Otherwise click ‘Join Scratch’ and create your free Scratch account.

  3. 3

    Open this starter file: https://scratch.mit.edu/projects/918136173/

  4. 4

    Click the “Remix” button to make your own copy

    Image to illustrate step 4
  5. 5

    Start by clicking on the "Player" sprite to make sure it's selected.

    Image to illustrate step 5
  6. 6

    Now drag some blocks in from the left to start coding...

    With these blocks we can move the player character up and down with arrow keys.

    Image to illustrate step 6
  7. 7

    Next add these blocks for left and right movement.

    Image to illustrate step 7
  8. 8

    Press the Green Flag and try using the arrow keys to move!

    Image to illustrate step 8
  9. 9

    Next let's code the guards that our character needs to avoid.

    The first guard will walk back and forth forever.

    Image to illustrate step 9Image to illustrate step 9
  10. 10

    Now select "Guard 2"...

    This guard will look in different directions over and over.

    Image to illustrate step 10Image to illustrate step 10
  11. 11

    Time to test it out! Press the Green Flag.

    Do you see the guards start to move?

    Image to illustrate step 11
  12. 12

    Let's code what happens when our player runs into the guards...

    This code will stop the game if the player gets caught by either of the guards.

    Image to illustrate step 12Image to illustrate step 12
  13. 13

    Press the Green Flag again to test.

    What happens if you run into the guards?

    Image to illustrate step 13
  14. 14

    Finally, we want to collect the key!

    This code checks to see if our player touched the key, and makes the key hide if so.

    Image to illustrate step 14Image to illustrate step 14
  15. 15

    Awesome work! Click the Green Flag to play the full game.

    Image to illustrate step 15

Thanks for building a game with us!

If you enjoyed this coding activity be sure to sign up for our online coding classes for kids. Our coding classes are a lot of fun, but they’re also really effective at teaching coding techniques and challenging students to develop their skills. You’ll learn about loops, variables and functions - and everything in between - and you’ll build your own games and animations with a small group of kids of the same age and experience level as you.

Sign up for one of our free coding lessons