Scratch Game
Advanced
60 mins
Teacher/Student led
+155 XP
What you need:
Chromebook/Laptop/PC or iPad/Tablet

Scratch Platformer

In this lesson you will learn the basics of creating a platformer game in Scratch.

Learning Goals Learning Outcomes

Teacher Class Feed

Load previous activity

    1 - Create a new Scratch project

    Go to the Scratch website, create a new project and delete the cat sprite.

    2 - Create your sprite

    In the game you will control a sprite that moves through the platforms. Paint a new sprite and give it two costumes, one costume with the eyes looking right (call this costume "right") and one costume with the eyes looking left (call this costume "left").

    You can design your sprite however you wish but for this example we will just use a simple box character with eyes.


    3 - Create your ground sprite

    For the platforms we will create a sprite that has multiple costumes. Each costume of the sprite will have boxes that we will draw that will act as the platforms.

    For now just create the new sprite and "design" the first costume with a box that covers all of the screen.

    In a later step, we will create some more costumes of this sprite with different platforms.



    4 - Create 3 variables

    Now let's create three variables that we will be using in our code:

    1. gravity - this will be the amount of gravity to apply to our character
    2. speed - this will be how fast our character moves left and right
    3. jump - this will be how high our character will jump

    Once you have created these variables, add the following code to your character sprite. This code will setup the game for the start.

    when green flag clicked go to x [0] y [0] set [gravity v] to (-15) set [speed v] to (10) set [jump v] to (40) switch costume to (right v)

    5 - Apply gravity

    Now let's apply some gravity to our character! If they are up in the air and not touching the ground, they should fall down. Add the following new code to your character sprite:

    when green flag clicked go to x [0] y [0] set [gravity v] to (-15) set [speed v] to (10) set [jump v] to (40) switch costume to (right v) // add new code under here forever if < not < touching (ground v) ? > > then change y by (gravity) end end


    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