Letters

Letters is one of the simplest Scratch applications and is recommended by the team at the MIT Lifelong Learning Group as suitable for one of the first projects created by new Scratch programmers.

The idea is to place the letters of your name onto the stage and use your own knowledge of Scratch to program different behaviour into each sprite which happens when you cliick on the sprite. Once you have investigated the letters by clicking on them, you press the space bar and the letters will all return to their original positions.

The Scratch Cards are useful for ideas for programming each letter adn there are endless behaviours you can program for each sprite from just spinning the letter around to playing sounds and drawing shapes.

Although this may be your first Scratch application, you will learn several concepts:

  • How the position of the sprite on the stage is represented with X and Y co-ordinates
  • Moving sprites with the glide command
  • Make sprites behave when you click on them
  • Create new sprites from existing graphics
  • Use the Scratch cards to investigate behaviour
  • Broadcasting a message from the stage script to get all the sprites to do something at the same time 

X and Y Co-ordinates

Move your mouse around the stage and look at the bottom right of the stage and you will see a value for X and a value for Y that changes as you move the mouse around. Move the mouse and see if you can work out what the co-ordinates for the top left and bottom right are (answer at the bottom of this section).

Glide Motion Block

Select your sprite and make sure you are on the scripts section and drag over the glide block from the motion blocks. Notice that the system puts in the current position of the sprite when you select the motion section (you can select another section and then go back to this section to set the current values). Put your sprite in the correct position by dragging with the mouse and then re-select the motion blocks and drag the glide block onto the script page. Move the sprite wirh your mouse and click on the glide block to see it return to the required position.

Click Control Block

You can use the when clicked on control block and create any behaviour you like. A good idea is to use the Scratch reference cards and program a different behaviour for each letter. Our example will just turn and move ten times using the turn and move motion blocks and the clicked on control block.

Create your behaviour by dragging blocks onto the scripts area for your sprite and test the behaviour by clicking on the blocks. Once you are happy with the behaviour, drag clicked on control block onto the top and click on the sprite to exhibit the behaviour. It is good practise to always give your sprite a meaningful name.

Create New Sprites

Create new sprites by using the button for chose new sprite from existing file and selecting from an existing graphic. You can also create and draw your own sprites with the create new sprites button. Edit the costume for an existing sprite by selecting the costumes tab for the sprite. You can have several different costumes for a sprite and change them with the costume command from the looks blocks.

Scratch Cards

The Scratch Cards have been prepared by the team at MIT and are available on the scratch site and have good ideas for programming different behaviour on your sprites. Use these (or your own ideas) to create different behaviour for each letter. Some examples might be:

  • Play a sound.
  • Start moving the sprite around the stage maybe with the pen down to draw shapes.
  • Some of the letters might respond to keypresses so they can be moved around the stage with the arrow keys.
  • Change costumes in a repeat loop to create an animation effect.

Each letter can be a showcase for the Scratch functionality that you are aware of or you can use it to discover new features.

The final feature of the application incorprorates a very important aspect of Scratch programming which is the way you control the behaviour of a number of sprites using a broadcast. In this case we want to broadcast a message to all the sprites to get them to return to their original positions.

Use the glide block to move to the original position and a good way to find out the X and Y coordinates is to move the sprite with the mouse to the position you want and read the co-ordinates from the top of the page. You may also find that the glide command has these filled in automatically for you.

The broadcast command shouts out a message to all sprites and those sprite that have a receive message controlo block with the same name will perform the behaviour you require. In this case we need behaviour for each letter to return to the original position.

Finally, a good place to organise behaviour that applies to your application is to put a lot of the control into the stage scripts. In our case we can add a keypress event when the space bar is pressed to broadcast the message.

Features used in this lesson:

  • Creative investigation and showcasing of a variety of Scratch behaviours.
  • Understanding X and Y co-ordinates.
  • Controlling multiple sprites with broadcast and receive.
  • Using the stage script for centralised control of the application.

Answers

The values for left/right are the X co-ordinate which can go from -240 to +240 and the up/down co-ordinate is the Y axis which can range from -140 to +140. So the top left is X,Y as -240,+140 and the bottom right is X,Y as +240,-140.

 

20/07/2017 15:44:05