1 of 10

Scratch Tips

Create Player Controls

2 of 10

3 of 10

Option 1 - Look where you’re going

  1. Use arrow keys and code on the right to control a sprite
  2. Note, this will make the sprite look in the direction they are moving

4 of 10

What is X and Y?

  • Like in math, X determines left and right, and Y determine up and down
  • -X moves to the left
  • +X moves to the right
  • -Y moves down
  • +Y moves up

5 of 10

Option 3 - More responsive controls

  • If you tried out one of the first two methods, you may have noticed they don’t work well if you want to press and hold the keys to move
  • Use code on the right to make a much more responsive controller for your sprite

6 of 10

Option 4 - More options

  • We can make it so more than one key does the same code by using an “or” operator block
    1. For example, use the arrow keys or WASD to control a player
  • To do so, select the two keys you want to do the same thing, then put each of them inside an “or” operator block

7 of 10

Option 4 - More options

  • Place the “or” operator block inside the “if” control block

8 of 10

Option 4 - More options

  • Repeat for each key

9 of 10

Use the tutorial button for more ideas and tips

10 of 10