Scratch Game
Beginner
40 mins
Teacher/Student led
+85 XP
What you need:
Chromebook/Laptop/PC or iPad/Tablet

Dino food game

In this project you'll create a game in Scratch. You'll add sprites, program them to move, add sounds and keep score!

In the game a dinosaur will roam around and catch beetles for food.

Lesson Files

Live Class Feed

This is a live feed of the latest activity by your students on this lesson. It will update in real-time as they work on the lesson.
Load previous activity

    1 - Create a new Scratch project

    Open the Scratch website in a new tab and create a new project. Delete the cat sprite from the project.

    2 - Add a character

    In the game we are going to make a dinosaur move around by using the arrow keys on our keyboard.

    But first let's add the Dinosaur4 sprite from the sprite library.


    3 - Shrink the dinosaur

    When the dinosaur sprite gets added to our project, it's a bit too big for our game so let's add some code to shrink it and make it smaller.

    Add the following code to the dinosaur sprite:

    whenclickedsetsizeto50%

    Click on the green flag and the dinosaur sprite will shrink to half it's normal size.


    4 - Make the dinosaur move up and down

    Next we will program the dinosaur sprite to move up and down when we press the up and down arrow keys on our keyboard.

    Each time we press an arrow key, we will point the dinosaur in that direction and then make them move 10 steps.

    Add the following code to the dinosaur sprite:

    whenup arrowkeypressedpointindirection0move10stepswhendown arrowkeypressedpointindirection180move10steps

    Once you've added the code test that it works by pressing the up and down arrow keys and checking that the dinosaur moves in the correct direction. If the dinosaur goes in the wrong direction, check that you have the right numbers in the code blocks.


    5 - Make the dinosaur move left and right

    Now we will program the dinosaur sprite to move left and right when we press the left and right arrow keys on our keyboard.

    Each time we press an arrow key, we will point the dinosaur in that direction and then make them move 10 steps.

    Add the following code to the dinosaur sprite:

    whenleft arrowkeypressedpointindirection-90 notice that this is MINUS 90 (-90)move10stepswhenright arrowkeypressedpointindirection90move10steps

    Once you've added the code test that it works by pressing the left and right arrow keys and checking that the dinosaur moves in the correct direction. If the dinosaur goes in the wrong direction, check that you have the right numbers in the code blocks.

    You will notice that the dinosaur goes upside down when you make it move left. We can fix this by using the "set rotation style [left-right]" code block. Add it underneath the "set size to (50) %" block:

    whenclickedsetsizeto50% add it under heresetrotationstyleleft-right



    Unlock the Full Learning Experience

    Get ready to embark on an incredible learning journey! Get access to this lesson and hundreds more in our Digital Skills Curriculum.

    Copyright Notice
    This lesson is copyright of Coding Ireland. Unauthorised use, copying or distribution is not allowed.

    Scratch is developed by the Lifelong Kindergarten Group at the MIT Media Lab. It is available for free at https://scratch.mit.edu
    🍪 Our website uses cookies to make your browsing experience better. By using our website you agree to our use of cookies. Learn more