Lesson video

In progress...

Loading...

Hi, everyone.

My name is Mrs. Jenkins.

I can't wait to learn with you today.

Welcome to today's lesson, which is called Design a Game that Uses Variables, and it is taken from the unit using variables in programming to develop a game.

By the end of today's lesson, you'll be able to design a project that builds on a given example.

Before we get started, we have two key words we're going to look at.

Those words will appear throughout the slide deck, so it's really important that we know what they mean before we get started.

The two key words are design and algorithm.

Design is a plan that shows how a programme should work.

An algorithm is a precise set of ordered steps, which can be followed by human or a computer to do a task.

In today's lesson, design a game that uses variables.

The first learning cycle is going to be design a programme that uses variables, and the second learning cycle is create effective algorithms. So let's get started with design a programme that uses variables.

This game is a catching game.

The programmer first made a design of their game.

Then they programmed it in Scratch.

The basket is controlled with the arrow keys.

The aim of the game is to collect stars and apples, and avoid bugs.

When you watch the game recording on the next slide, think about these questions.

How many sprites are there? What do the sprites do? Do the sprites all fall at the same speed? How do you know how well you have done? So there's questions on the side there.

Just watch the video.

How many sprites are there? What do the sprites do? Do the sprites all fall at the same speed? How do you know how well you have done? So how many sprites are there? There are eight sprites, the bowl, the star, the bug, four apples, and the purple line sprite at the bottom.

What do the sprites do? "You use the arrow keys to move the bowl.

The apples fall down and add one to the score.

When they touch the basket, the bug takes away five from your score, and the star adds three when it touches the basket." Great job, Izzy.

Thank you.

When the falling sprites touch the purple line sprite, they go back to the top of the screen.

That's right.

Great job.

Do all the sprites fall at different speeds? Laura says, "The sprites fall at different speeds, sometimes fast or slow." How do you know how well you have done? You have to try and get your score as high as possible.

The more stars and apples that you catch with the bowl, the more your score increases.

Okay, a little check here.

What variables did the catching game use? Have a go.

How did you get on? I asked you, what variables did the catching game use? And the catching game used a score variable and a timer variable.

A second question, how did the values held in the variables change? Have a go.

For the score, apples added one to the score, the bug took away five from the score, and the star added three to the score.

And for the timer, it counted down from 20 to zero.

Great job.

In this lesson, you will be designing your own catching game and creating algorithms for your game.

Your catching game should have a score at least three falling objects, and the objects should fall at different speeds.

What parts of the game looked fun to play? How could you add or change parts of that game? Andeep says, "Watching that game gave me lots of ideas." And Sofia said, "I think my version of the game would be even more fun." Thank you guys.

For your game, you will need at least three sprites, the catching sprites like the basket and two or more falling sprites.

When designing, it is worth thinking about a theme.

Your sprites and backdrop should have a matching theme.

So we will open the project, which is the oak link for catch.

This is a basic version of the catching game.

The apples and the bug have been removed.

This will be the basis for your game.

So you're going to choose a theme for your catching game.

Izzy says, "I want my game to be animal-themed." Sofia has said, "I'm thinking of using outer space as my theme." And Laura has said, "I'd like my game to be set in a garden." Once you have a theme, choose what kind of sprites you want.

You can look through the scratch sprite library to get some ideas.

To open the scratch sprite library, hover over the cat button, select the cat button to open the library.

Look through the available backdrops to get ideas.

To open the scratch backdrop library, you can hover over the backdrop button and select the backdrop button to open the library.

Okay, for task A, I would like you to write down your theme, choose two or more sprites as your falling sprites, record the name of each sprite and draw it, and record the backdrop.

So we've given you the first one, which is sprite 1 falling star.

Have a go.

How did you get on? I asked you to write down your theme and choose two or more sprites as your falling sprites, and record the name of each sprite and draw it.

Then record the backdrop.

Here are my examples.

I have chosen outer space as my theme.

My sprite 1 is a falling star, sprite 2 is a planet, and sprite 3 is a rocket.

So I'm going to have a backdrop of space.

You could share your ideas with those around you.

Okay, we're gonna move on to learning cycle two now, create effective algorithms. Andeep says, "Designing sometimes feels like a waste of time." It'd be faster to just start coding right away.

Why is it useful to spend time designing a coding project? What do you think? Izzy explains, "Designing your game is like drawing a map before you go on a trip.

If you don't know where you're going, it's easy to get lost." Laura says, "A clear design helps you code more quickly and with fewer mistakes, because you already know what your code is supposed to do." Great answers, Izzy and Laura.

Thank you.

Okay, for our check in now, I'd like you to fill in the blanks.

There are, mm, to create a design before you start to programme.

A clear, mm, helps you, mm, more quickly, and with fewer mm, because you already know what your code mm is to do.

And you've got the words below, design, benefits, supposed, code, and mistakes.

Have a go.

How did you get on? I asked you to fill in the blanks.

So there are benefits to creating a design before you start a programme.

A clear design helps you code more quickly and with fewer mistakes, because you already know what your code is supposed to do.

Great job, everyone.

The next step is to design what happens in your game using variables.

Laura asks, "What are variables?" And Andeep explains to us, "Variables are named and stored in a computer's memory." Izzy asks, "What is an algorithm?" An algorithm is clear and precise instructions, which can be followed by a human or computer to complete a task.

For example, when a green flag is clicked, set the score to zero.

If the apple touches basket, score one point.

If the star touches basket, score three points.

If a bug touches the basket, take away five points.

True or false.

Algorithms are the same as programming.

Have a go.

How did you get on? I asked you, true or false? Algorithms are the same as programming.

It's false.

An algorithm is a set of clear instructions a human can understand while programming is how you give commands to a computer.

Sofia explains, "I have written an algorithm for the falling star.

The falling star moves down by eight from a random X position at the top of the screen.

If the sprite falls onto the bowl, change the score by three.

It falls again from a random exposition at the top of the screen.

If the falling star touches the screen bottom, it falls again from a random x position at the top of the screen." Okay, and we've got a diagram next to it showing exactly what she means.

So Sofia's algorithm includes a diagram and a written description.

Even though coding in Scratch is the final goal, you don't need to do any programming in this lesson or think about the code.

You are only recording ideas and designing algorithms at this stage.

Andeep says, "I drew my design and wrote my algorithms, but I didn't write any code." Okay, we're going to move on to task B now.

And for this, I would like you to design your algorithms. So you're going to write algorithms for two new sprites.

Each algorithm should include a drawing and a description.

Some design suggestions, each sprite should change the score by a different amount.

You could use a negative number, e.

g.

minus three.

Each sprite can move to different speed, and the sprites can be different sizes.

Have a go.

How did you get on? I asked you to write algorithms for the two new sprites.

Each algorithm should include a drawing and a description.

Some design suggestions were each sprite should change the score by a different amount.

You could use a negative number, e.

g.

minus three.

Each sprite can move to different speed, and the sprites can be different sizes.

Here's my examples.

We have got some drawings of rockets, and the rocket moves down quickly from a random x position at the top of the screen.

If the sprite falls onto the bowl, change the score by minus two.

It falls again from a random x position at the top of the screen.

If the rocket touches the screen bottom, it falls again from a random x position at the top of the screen.

And for my second one, we've got some planets.

The planet moves down slowly from a random exposition at the top of the screen.

If the sprite falls into the bowl, change the score by one.

It falls again from a random x position at the top of the screen.

If the planet touches the screen bottom, it falls again from a random exposition at the top of the screen.

Great job, everyone.

You've worked so hard today.

Let's summarise our learning.

Creating a design for a programme is important because it helps you code more quickly and with fewer mistakes, since you already know what your code is supposed to do.

When making a programme, it is important to think about what variables you are going to use.

A variable is a named value that could be changed while the programme runs.

Creating algorithms as part of the programme design can help simplify the thinking.

Well done, everyone.

You have worked extremely hard today.

I hope to learn with you again soon.