0% found this document useful (0 votes)
9 views4 pages

A3 Worksheet - Modify The Code

This document outlines a programming activity for Year 7 students using Scratch, focusing on creating a simple flying game with a cat character. It includes tasks for modifying movement, adding gravity, preventing the cat from falling off the screen, and automating the cat's starting position. Additionally, it suggests ways to extend the game with features like lives and timers.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views4 pages

A3 Worksheet - Modify The Code

This document outlines a programming activity for Year 7 students using Scratch, focusing on creating a simple flying game with a cat character. It includes tasks for modifying movement, adding gravity, preventing the cat from falling off the screen, and automating the cat's starting position. Additionally, it suggests ways to extend the game with features like lives and timers.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Year 7 - Programming essentials in Scratch: part II Learner activity sheet

Lesson 8 - Fly cat, fly!

Modify the code


This is a pair programming activity. Assign driver and navigator roles to get you
started and ensure that you switch roles every five minutes.

Task 1 Add simple movement to the cat


Steps Guidance
1. Make the cat go up when For the cat to fly up and down, you need to
the Up arrow is pressed change the sprite’s position on the y-axis. The
y-axis is used for up and down.

● Add these blocks to the cat flying


sprite:

2. Make the cat go down when ● Using the example above, make the cat go
the Down arrow is pressed down by ‘-10’ each time the Down arrow
is pressed.
3. Test your code ● Press the Green flag to see if your code
works as you expect it to.

If your code is working correctly, it should go


up when the Up arrow is pressed and down when
the Down arrow is pressed.

Task 2 Add gravity (make the cat ‘fall’)


Steps Guidance
1. Introduce the cat to Pressing the Down arrow to move the cat down can
gravity seem a little boring to some players, so let’s
add a little excitement to the game.

The block of code that makes the cat go down is


this one:

Page 1 Last updated: 09/03/2021


Year 7 - Programming essentials in Scratch: part II Learner activity sheet
Lesson 8 - Fly cat, fly!

If you place this block inside a Forever block


what might happen?

● Find the Forever block and add this block


of code within the loop.

2. Test your code ● Press the Green flag to see what happens
when your code is run.
● Are you missing a vital block of code?
Hint Don’t forget to add ‘When green
flag clicked above your Forever loop.

If your code is working correctly, Scratch the


cat should drop down to the bottom of the screen
when the Green flag is clicked.

Task 3 Make the cat fly


Steps Guidance
1. Get the cat to fight For your cat to fight against gravity it needs
against gravity and fly! some instructions. At the moment when you press
the Up arrow, the cat should move up.

● Press the Green flag to run your code and


see what happens when you press the Up
arrow.

You will notice that the cat tries to move up,


but gravity pushes it back down again.

● Adjust the values in both Change y by ()


blocks and keep testing your game until
it is easier for the cat to fly up the
screen.

Page 2 Last updated: 09/03/2021


Year 7 - Programming essentials in Scratch: part II Learner activity sheet
Lesson 8 - Fly cat, fly!

Task 4 Stop the cat from dropping off the screen


Steps Guidance
1. Stop the cat from falling Now you want the cat to keep falling until it
off the screen gets to the bottom of the screen. Instead of
using a Forever loop, what other loop could be
used?

● Introduce the alternative loop to your


game

● Here is a hint to help you if needed: y


position is less than -180
2. Test your code ● Make sure that Scratch the cat is near the
top of the screen before pressing the
Green flag and testing your code.
● What happened?

If your code is working correctly, Scratch the


cat should have dropped to the bottom of the
screen and then stopped. You should have the
ability to move it up, but not down.
3. Automate the cat's In the last step you had to physically move the
position at the start of cat to the top of the screen in order to test
the game the code. You can automate this by telling
Scratch the cat to start the game in a certain
position. How might you do this?

● Think about the blocks of code that might


be needed to tell Scratch the cat where to
start the game
● Test your approach and continue to test it
until it is working

If your code is working correctly, when the


Green flag is clicked the cat should go to the
top of the screen and then move (float) to the
bottom and then stop.
4. Getting the cat to jump At the moment the game is quite boring because
back up to the start the cat just goes to the bottom and then stops.
position within game play You need to get the cat to keep going back to
the start position if it drops off the screen.

Now you need the Forever loop back!

● Introduce the Forever loop back to the


game. Think about where it will need to be
positioned so that the cat falls down and

Page 3 Last updated: 09/03/2021


Year 7 - Programming essentials in Scratch: part II Learner activity sheet
Lesson 8 - Fly cat, fly!

pops back up again.


● Test your approach and keep testing it
until it works

If your code is working correctly, Scratch the


cat will appear at the top of the screen and
float down. When it is at the bottom of the
screen, it will jump back up to its starting
position.

Extending your game


You now have the basic workings of a flying game. Here are some ideas for
extending it further:

● Add lives to the game and make the cat lose a life each time it drops to
the bottom
● The character could also lose a life if it hits a building
● You could add a timer and see if the cat can fly the whole distance without
dropping or hitting a building

Resources are updated regularly — the latest version is available at: ncce.io/tcc.

This resource is licensed under the Open Government Licence, version 3. For more information on this
licence, see ncce.io/ogl.

Page 4 Last updated: 09/03/2021

You might also like