Skip to content
Transcript

This add-on will show you how to make the stamp clones turn when the user presses the arrow keys.

First, make the sprite turn left.

Select the Arch sprite and drag out the “turn left” block.

Now, make the sprite turn left only when the left arrow is clicked.

Usually, this would be done with the “when key pressed” event block.

That turns both the stamp and the original sprite.

If all the sprites were coded using the “when key pressed” block, they would all move.

To move only the clone sprite, the code needs to be under the “when I start as a clone” event.

Code can only be started by one event at a time.

Luckily, Scratch offers something called a key-press condition.

Place an “if” block inside the “repeat until” loop.

If this block is placed outside the loop, the program will only react to the key once, and then only if the user is pressing it when the program gets to that block.

If it’s inside the “repeat until” loop, however, the program will keep checking the condition until it stops running.

Next, add the condition that will tell the program the user action it should react to.

In this case, that’s “key pressed,” so from the “sensing” menu place a “key pressed” block inside the if.

Then, click the dropdown and select “left arrow key.”

Finally, complete the conditional statement with what should happen if the left arrow key is pressed.

Drag the “turn left” block into the “if left key pressed” block.

Delete the “when space key pressed” event.

Test the code.

Click on the sprite, press the left arrow key, and watch the stamp turn left.

Next, make the clone turn right when the right arrow key is pressed.

Use your computer science knowledge to code your sprite to turn in both directions.

Make your other sprites turn as well.

Rather than re-creating code a bunch of times, simply copy the code to the other sprites.

First, drag the code into your backpack.

For each sprite, delete the old code for “when I start as a clone,” and replace it with the code from the backpack.

When you are finished, right click on the code in the backpack and delete it so your backpack doesn’t get too full.

To make your original sprite return to how it started, click on the “motion” menu, then the “point in direction” block.

Make sure the number in this block is 90.

Once you’ve finished this add-on, update the instructions on your project page so people know to press the arrow keys to turn the sprites.

You can return to your project by clicking the “see inside” button.

Now, it’s your turn: Make clones turn left using an “if left arrow key pressed” condition and an if/then block.

Place the “turn left” block inside the condition.

And make the sprite turn right when the right arrow key is pressed.

Finally, make all the sprites turn by copying the code.

Choose an Add-On

Falling Blocks (Part 1 of 2)

Create a game in which users create a building using falling blocks.

Falling Blocks (Part 2 of 2)

Create a game in which users create a building using falling blocks.

Rainbow City

Make the landscape turn into rainbow colors.

Detail Work

Make the sprites change size!

World Renowned Architect

Change the backdrop to other scenes.

Blueprints (Part 1 of 2)
Blueprints (Part 2 of 2)
Rotator

Make the shapes turn and rotate!

Instructions

  1. Choose an Add-On, and click "watch" to learn how to build it.
  2. Once you finish one Add-On, try another one below the video!