Scratch
Advanced
45 mins
Teacher/Student led
What you need:
Chromebook/Laptop/PC or iPad/Tablet

Scratch Gravity and Jumping

This lessons teaches you how to make a character jump and have gravity pull them back down to the ground in Scratch.

Teacher Class Feed

Load previous activity

    1 - Create a new Scratch project

    Create a new Scratch project and delete the cat sprite.

    2 - Add the Dinosaur4 sprite from the library.

    Change it's size to 50% in the Sprite properties and then add the following code to the dino sprite:

    when green flag clicked set rotation style [left-right v] // this is important for when we make it move left and right later go to x [0] y [140] // place it at the top center at the start go to [front v] layer // make it appear over the ground sprite


    3 - Draw the 'ground' sprite

    Use the sprite editor to draw a 'ground' sprite. Use the Rectangle tool to draw a green box and drag it so it covers the bottom half of the stage area.

    Rename this sprite to 'ground' in the sprite properties.


    4 - Create a 'gravity' variable and make the dino fall

    Create a variable called 'gravity' and then add the below code. This code makes the dino fall if it's not touching the ground.

    when green flag clicked set rotation style [left-right v] go to x [0] y [140] go to [front v] layer // add the new code under here set [gravity v] to (0) forever if < not < touching (ground v) ?> > then change y by (gravity) change [gravity v] by (-1) end end


    123learn · Online learning platform

    Unlock the full learning experience

    You're previewing this lesson. Get full access to this lesson and hundreds more — each one ready to teach, with interactive activities, printable resources and pupil progress tracking built in.

    Hundreds of curriculum-aligned lessons
    Interactive activities in every lesson
    Printable resources & progress tracking
    Copyright Notice
    This lesson is copyright of Coding Ireland 2017 - 2026. 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