Step 3

Goal:


Our next step is to create our first controls using conditional “if” statements.

We will code our game so that if the right arrow key is pressed, scratch will move along the X-axis position +10 steps. This will make him move to the right!

Steps:

  1. Click on Control.
  2. Drag  IF to an empty space.
  3. Click on Sensing.
  4. Drag  Key space pressed? into the IF block.
  5. Select right arrow.
  6. Click on Motion.
  7. Drag  Change x by into the IF block.

Code:


Click to replay