Introduction

In this project you’ll learn how to code your own tech toys!

  • Click the bow tie to see it spin;
  • Click the sunglasses to see them change colour;
  • Click the laptop to power up the helicopter;
  • Press the arrow keys to fly the helicopter;
  • Press the space bar to make the helicopter loop-the-loop.

Step 1: Spinning Bow Tie

Let’s code a bow tie that spins when clicked.

Activity Checklist

  • Open the ‘Tech Toys’ Scratch project. Your club leader will give you a copy of this project, or you can open it online at jumpto.cc/toys-go.

  • Click on the ‘Bow Tie’ sprite and add this code:

    screenshot
    screenshot
  • Click the bow tie to run your code. You should see that your bow tie turns 15 degrees clockwise 10 times, turning 150 degrees in total.

    screenshot
    screenshot
  • Find the point in direction block and, without dragging it, click it to set the bow tie back to its starting position.

    screenshot
    screenshot

    Tip: In Scratch you can click on a block to run it straight away. You don’t even need to drag it onto the scripts area first!

  • To make the bow tie do 1 complete spin, the numbers in your code need to add up to 360 degrees. Change your code so that the bow tie turns 36 degrees 10 times (36 x 10 = 360).

    screenshot
    screenshot
  • Test your code again. This time, your bow tie should do 1 complete 360 degree spin and end up where it started.

  • If you want your bow tie to do 4 complete spins, you can change the number in the repeat block from 10 to 40.

    screenshot
    screenshot

Save your project

Challenge: Colour-changing sunglasses

Can you use the following code to make your sunglasses change colour when clicked?

screenshot
screenshot

Remember that you can change the numbers in the code blocks if you want to!

Save your project

Step 2: Powering up your helicopter

Let’s code your helicopter to start up when your laptop is clicked.

Activity Checklist

  • Let’s start by broadcasting a start message when the laptop is clicked. You’ll need to create a new message called start.

    screenshot
    screenshot
  • Your code should look like this:

    screenshot
    screenshot

    This code broadcasts a message to all other sprites. If you test this code, you’ll see that nothing happens yet! This is because you’ve not coded the helicopter to respond to the message.

  • Click on your helicopter sprite and add a When I receive block. Any code attached to this block will be run when it receives the ‘start’ message from the laptop.

    screenshot
    screenshot
  • If you click your helicopter’s ‘Costumes’ tab, you’ll notice that it has 2 costumes with slightly different propellers.

    screenshot
    screenshot
  • You can use the 2 costumes to animate the helicopter. Add this code, so that the helicopter changes costumes forever once it receives the ‘start’ message.

    screenshot
    screenshot
  • Test your code by clicking your laptop sprite. Does your helicopter’s propeller animate?

    screenshot
    screenshot

Save your project

Step 3: Flying your helicopter

Let’s use the arrow keys to fly your helicopter.

Activity Checklist

  • Let’s start by coding your helicopter to move up when the up arrow is pressed.

    screenshot
    screenshot
  • Test your code and you’ll see that your helicopter’s y position (up/down) changes whenever the up arrow is pressed.

  • If you want your helicopter to move more smoothly, you can instead add code to move upwards inside your helicopter’s forever loop.

    screenshot
    screenshot
  • If you test this new code, you’ll see that the movement is smoother than before.

  • You can also code your helicopter to move to the left when the left arrow is pressed. This time you’ll need to change the helicopter’s x postition by -5.

    screenshot
    screenshot
  • For smoother motion, you can instead add more code to your helicopter’s forever loop.

    screenshot
    screenshot

Save your project

Challenge: More controls

Can you code your helicopter to respond to to the down and right arrow keys?

Save your project

Step 4: Loop-the-loop

Let’s code your helicopter to do a 360 degree spin.

Activity Checklist

  • We want the helicopter to do a 360 degree spin whenever the space key is pressed. Remember that the numbers in your code need to add up to 360.

    screenshot
    screenshot
  • Test your code by pressing space, and you’ll see that your helicopter spins very slowly. That’s because it only turns 1 degree 360 times.

  • To speed up your helicopter’s spin, change the numbers in your code so that it turns more degrees fewer times. It doesn’t matter what numbers you choose as long as they add up to 360!

    screenshot
    screenshot
  • If you want your helicopter to move as well as spin, just add a move block to your code.

    screenshot
    screenshot
  • Press space again to test your code. You should see your helicopter move in a circle. What happens if you change the number in your move block?

    screenshot
    screenshot

Save your project

Challenge: Create your own tech toy!

Can you create your own tech toy?

You could make the antennae move whenever they’re clicked? Here’s the code blocks you will need to use:

screenshot
screenshot

You could make any tech toy you like. Here are some other sprites you could use:

screenshot
screenshot

Save your project