Scratch Movement + Makey Makey
Grades 3โ€“5

Learning Target

1. Make a character move left, right, and jump in Scratch.

2. Connect the makey makey to the scratch code.

Success Criteria

  • Sprite moves left (change x by -10)
  • Sprite moves right (change x by 10)
  • Sprite jumps (repeat up / repeat down)

Materials

  • Scratch
  • Makey Makey + Controller
Scratch Movement Works

How Scratch Movement Works

  • Left/Right: change x. Right is positive; left is negative.
  • Up/Down: change y. Up is positive; down is negative.
  • Jump: increase y a few times, then decrease to land.

Types of Basic Movements

  1. Keyboard Inputs: Use key presses to move the character.
  2. Computer Controlled: Move the character automatically.
  3. Mouse Inputs: Move the character with the mouse.

Today we will focus on Keyboard Inputs

Step 0: Open Scratch

  1. Open Scratch
  2. Create a new project
  3. Create a new sprite
  4. Save the project

Step 1: Make Character Move to the Right

Keyboard Inputs

Step 2: Make Character Move to the Left

Keyboard Inputs

Step 3: Make Character Jump Up

Step 4: Make Character Jump Down

Jump Mechanics

Now we will connect the makey makey to the scratch code.

Makey Makey Setup

  1. Connect via USB to your computer
  2. Connect โ†, โ†’, and SPACE to makey makey code labeled LEFT / RIGHT / JUMP.
  3. Touch pads to control the same Scratch code.

Makey Makey Code

Makey Makey Code
when [left pad v] pressed
  change x by (-10)

Makey Makey Code for Right

Makey Makey Code
when [right pad v] pressed
  change x by (10)

Makey Makey Code for Jump

Makey Makey Code
when [space pad v] pressed
  change y by (5)
  repeat (10)
  change y by (-5)

Review

What is the Makey Make code compare with the keyboard code?

  1. What does the X do? What does the Y do?
  2. How is the Makey Makey code different from the keyboard code?
  3. How is the Makey Makey code the same as the keyboard code?
  4. What is the difference between the left and right code?
  5. What is the difference between the jump up and jump down code?

Extra Challenges

  • Add gravity to the code.
  • Add a color change to the code.
  • Create 2 characters that can move and jump.
  • Add a jump count using variables

Explore Further using other projects

โญ See Student Movement Games!

Check out amazing movement games created by students who completed this lesson! Get inspired and see what's possible.

๐Ÿ’ก Want to share your movement game? Submit your project using our submission form and it could be featured on the student work page!

๐Ÿง  Concepts to Remember (For Later)

Optional extra reading. Skim the bold parts.

Big idea: There are 3 common ways to control a character in Scratch.

1) โŒจ๏ธ Keyboard Inputs

Use when: the player should control the character.

  • Left / Right: change x
  • Up / Down: change y
  • Turn: turn degrees (smaller = smoother)

Quick recipe:

  1. Events: when green flag clicked
  2. Control: forever
  3. Control: if <key pressed?> then
  4. Motion: change x/y or turn
Show example
when green flag clicked
forever
  if <key (right arrow) pressed?> then
    change x by (10)
  end
end

2) ๐Ÿค– Computer Controlled (Automatic)

Use when: you want movement without a player controlling it (like an enemy).

Quick recipe:

  1. when green flag clicked
  2. forever
  3. glide (1) secs to x: (pick random) y: (pick random)
Speed tip
  • Faster: smaller glide time (0.1โ€“0.9)
  • Slower: bigger glide time (2โ€“5)

3) ๐Ÿ–ฑ๏ธ Mouse Inputs

Use when: the character should follow your mouse.

Quick recipe:

  1. when green flag clicked
  2. forever
  3. go to x: (mouse x) y: (mouse y) or glide (0.1) secs to x/y
Tip for smooth control

Use a tiny glide (0.1) to make it smooth but still fast.