Introducing movement with Scratch

This post will be referring to a publicly available and free project made by CodeClub Australia. CodeClub Australia has some wonderful projects that are documented for beginning Scratchers. Each year they run a program called MoonHack. In 2020 there were over 34000 participants in the project worldwide. They have multiple projects for a range of ages from early years to high school. https://moonhack.com/projects/

The 2020 the "Space CleanUp" project focused on the problem of Space Junk. There is a 10 min video discussing the problem. There is also an additional Blog Post with some extra reading about Space Junk should you be interested.

This project could be used in the Year 5 space content for Australian Curriculum. It is suitable for year 4 and up. Or year 3 with some experience coding. The projects will take an experienced coder about 45mins. But less advanced coders could take up to 2 x 1 hour lessons.

Before using it in your class, be sure to complete the project yourself so you know what difficulties may arise. This is a great insight into how the project works and possible errors students may make, so you can be one step ahead.


Page 2 of the Instruction booklet is very important for the teacher. 


It has a starter file. You can put the link in your Google Classroom or Teams platform. This is an important file as it contains the sprites that are referred to in the instructions.

The link for the Scratch Project Starter file is bit.ly/mhspacecleanup 

This project will introduce concepts such as 
  • Conditional movement
  • Forever Loops (Iteration)
  • If Statements (Branching)
  • Broadcasting
  • Multiple Sprites
  • Shortcuts for copying code

When teaching the theory the first lesson is to talk about the movement of the rocket. How does the rocket move?

It is important the students understand how the code works. This will require an understanding of the x and y co-ordinates and how negative values work.



Event Block

The first block - When Flag Clicked is the event block. This event will start the game. If you don't click the flag nothing will happen.

Starting Point

The go to x:-200 y: -133 will position the sprite at that point eveytime the flag is clicked. This ensures you have a consistent starting point each game. It also ensures the sprite doesn't start off the screen.

Direction and Co-ordinates

The Scratch program runs with co-ordinates. You can code the position of sprites using (x, y) values. 

The students will need to understand numberlines, co-ordinate geometry or Cartesian Planes to understand this concept.

X is the horizontal axis. Positive values move right. Negative values will move left. Values to the left of the centre 0 will be negative.

Y is the vertical axis. Positive values move up. Negative values will move down. Values below the centre 0 will be negative.

Mixing up the Change X or Change Y block will result in the sprite moving the wrong direction. Mixing up the positive or negative values will do the same thing.

Coding the movement this way allows you to have just one event for the navigation of the sprite.

If..Then

The If ... Then blocks are conditional, they will only work if the blue condition block is true. So IF the UP arrow is pressed THEN the sprite will MOVE up 10 pixels. (A pixel is the unit of measurement on a screen)

Forever

The Forever block is an example of iteration. It will allow the code inside the loop to continue till you end the game. Without this block the arrow keys would only operate once and the navigation would not work.

Because the code works with the Arrow keys it would be possible to add a Makey Makey game controller to enhance the experience of the game. 

Completed code for the project can be found here.



Comments