Scratch Basics Episode 5: Make Your Sprite Fly Around

Becky Wright

Becky Wright

About the author

Becky is an educator and the Lead Digital Skills teacher at the Lindsay Pinnguaq Makerspace. She is passionate about developing an intrinsic motivation for learning within every student she meets. Becky graduated from the University of the Pacific with a Bachelors of Arts in Liberal Studies with a Major in Human Development and Special Education, and a Masters of Arts Degree in Curriculum and Instruction. Prior to beginning her role as an educator for Pinnguaq, she taught grades sixth through eighth in a Montessori school structure. She also spent five years teaching a range of grades from preschool to eighth grade in Bangkok.

In the series: Scratch Basics Series


Introduction

Scratch is a basic coding language that uses a ‘building block’ style coding to create animated stories, interactive games, simulations, and beautiful artwork. In using Scratch, learners will be introduced to basic coding concepts and develop their computational thinking skills while bringing their own ideas to life. In this series, the basics of Scratch will be introduced to provide learners with the foundational skills required to begin creating in Scratch. 

Scratch makes it easy for learners who are just starting out by organizing the types of code you can use into categories. The code blocks are grouped by the following categories: Motion, Looks, Sound, Events, Controls, Sensing, Operators, Variables and My Blocks. These code blocks can be pieced together in the Code Area like placing jigsaw puzzle pieces together. Both the Code Area and the Stage are visible at the same time which allows learners to run code, test, debug and view their creations. 

In this episode, learners will explore: 

  • Make their sprite glide around the Stage
  • New Events block “when this sprite clicked”

New Motion block “glide 1 sec to random position”

Vocabulary

The following vocabulary definitions are directly from Scratch Wiki.

Block Palette (Scratch)
he Block Palette is the area on the left of the screen when the Code button is opened. On the left, there is an area that contains the nine sections of blocks in Scratch. To the right of that, there is an area that contains blocks that can be dragged into the Code Area to make code.
Code Area (Scratch)
The Code Area is the large empty space to the right of the Block Palette. It is an area for storing blocks that run the project. Blocks can be dragged from the Block Palette into the Code Area and arranged to form scripts.
Events (Scratch Block Category)
These blocks are used to sense events, which trigger scripts to run.
Motion (Scratch Block Category)
These blocks are used to control a Sprite’s movement.
Sprite (Scratch)
Either user-created, uploaded, or found in the sprites library, are the objects that perform actions in a project.
Sprite Pane (Scratch)
It is a white area located beneath the Stage where all sprites present in a project can be easily accessed to modify or inspect.
Stage (Scratch)
The stage is the area where the sprites are and perform their actions. It is located in the top of the area to the right of the Code Area.

Materials


Computer Activity

This episode will take you through the steps of making your sprite fly around the Stage using a Motion block.

Add Your Sprite and Background

  1. Choose a Backdrop for your project and a Sprite that you want to code to fly around the Stage. If you need help with how to choose a Sprite, see Scratch Basics – Episode 2: Deleting a Sprite, Adding a Sprite & Adding a Backdrop for more information.
A bird flying around on the scratch stage area.

Code Your Sprite to Fly Around the Stage

  1. Click on the sprite in the Sprite Pane so that it is ready to receive code. 
The Parrot sprite located in the sprites pane.
  1. Drag a “when space key pressed” block from the Events category in the Block Palette into the Code Area. This yellow Events block will tell your code to run when you press the space key on your keyboard. 
Sensing blocks in Scratch.

If you click on the drop-down menu on this block, you can choose a different key on your keyboard as the input for starting your code. You can choose a letter, number or arrow key. 

When space key pressed block.
  1. Go to the dark blue Motion category in the Blocks Palette. This category has blocks that will control the movement of your sprite in different ways. Select the “glide 1 sec to random position” block. Drag this block onto the Code Area and snap it underneath the “when space key clicked” block.
Red arrows pointing to code area.

This Motion block will have your sprite glide to a random position on the Stage and it will take one second for it to reach its destination. 

Press the space key on your keyboard to test your code! When you hit the space key, you’ll notice that the sprite glides to a random position on the Stage and it will take one second! If you keep pressing down on the space key, your sprite will continuously glide in a different direction every second.  

Changing How Fast Your Sprite Glides

  1. The first white bubble on this block is a number input, this is where you can change the number of seconds that you want your sprite to glide for. If you make this number larger, the Sprite will glide more slowly. If you make this number smaller, the sprite will glide more quickly. 
Glide 1 secs to random position block.

Make Your Sprite Glide Towards Your Mouse Pointer

  1. The second bubble on this block is a drop-down menu that you can use to  set the direction that the sprite will glide to. You can click on this menu and choose to change the direction of the sprite to make it glide towards the mouse pointer instead of a random position. 
Mouse pointer option in the glide block.

Test this by pressing the space key and watch how the sprite glides to where your mouse is on the Stage


Conclusion

In this episode, you learned basic Scratch concepts such as how to make your fly around the Stage by using a Motion block. What will you create now that you have learned a few Scratch Basics?

We want to see the awesome things you’re creating! Take a photo or video and share your work with us by emailing media@pinnguaq.com or tagging @pinnguaq on Facebook, Twitter, or Instagram. Don’t forget to include the hashtag #LearnWithPinnguaq! You can also upload your project to the Pinnguaq Studio


Resources


You might also like

Previous In Series

Next In Series