Level 6

Jump and Fall

Level 6 · Chapter 1

What this lesson follows

CSTA K–12 Computer Science Standards (2017)

Algorithms & Programming · Grades 6–8

Name variables well and work with their values.

Code 2-AP-11Read the official text

Also practised: 2-AP-12

Common Core State Standards for Mathematics

The Number System · Grade 6

Use negative numbers on the number line.

Code 6.NS.C.5Read the official text

The short lines are our own words. We matched this lesson to these standards ourselves; the standards' owners have not reviewed or endorsed this course.

Common Core State Standards © 2010 National Governors Association Center for Best Practices and Council of Chief State School Officers. All rights reserved.

Today you will make a sprite jump up and fall down using one number that changes every loop.

1👋 Warm-Up

For teachers · goals · guide
Lesson Outcomes · for teachersCSTA 2
✦ CSTA 2-AP-11 · CSTA 2-AP-12 · ISTE 1.5.c · Standards
🎯 I canmake a sprite jump up and fall down using one number that changes every loop
📝 New words6 words
⏱ Lesson time~45 min
Teacher Guide

📋 Before class

⚠️ Common misconceptions

  • Students think moving y by the fall-speed number is the same as setting y. change y by (vel_y) adds the fall-speed number to the current position each loop — the moves add up.
  • Students set vel_y to 0 every loop instead of only when touching the ground. The down step must happen every loop; reset only on landing.
  • Students put the jump step inside the down step. Jump and fall must be separate if-branches — only one runs per loop.

🎯 Differentiation

🐢 Struggling: Start with falling only — no jumping. Get the sprite falling and landing before adding the space-key jump.

🚀 Advanced: Make the jump height change: the longer the player holds space, the more loops vel_y goes up before it starts to fall (hold-to-jump).

💡 During the lesson

  • Warm-UpAsk students: "If Pico is in the air and nothing is touching him, what should happen?" (He falls.) "If he is on the ground, what should happen?" (Nothing — the floor stops him.) This motivates the ground check before introducing the code. The vel_y number is just a label for the sprite's fall speed: a plus number moves it up, a minus number moves it down, and it goes down by 1 each loop.
  • Try ItDraw a number line on the board. vel_y starts at 0. Each loop: take away 1. At loop 12: vel_y = -12. The sprite moves down 12 pixels that loop. When it touches the ground: set it back to 0. When it jumps: set it to +12. The up-and-down curve is just this number line played over time.
    The first experiment has no ground check, so nothing stops Pico — he falls straight through the floor to the bottom of the stage. The second experiment adds one new block: the ground check. Pick 0 in the first experiment to show what the fall step does: with 0, vel_y stays at 0 forever — no movement. Each experiment changes one number in the blocks.
  • PlanThe flowchart order matters. The fall step must run before the ground check, or the sprite will sink into the floor on the first loop. The jump check sits inside the ground check, so Pico can jump only while he stands on the floor.