Loading...
Hi everyone.
My name is Mrs. Jenkins.
I can't wait to learn with you today.
Welcome to today's lesson taken from the unit using variables in programming to develop a game.
Today's lesson is called Improving and Sharing.
By the end of today's lesson, you'll be able to evaluate and improve your coding project.
In today's lesson, we have two key words.
They're going to appear throughout the lesson, so it's really important that we understand what they mean before we get started.
Those words are improve and evaluate.
Improve is to make changes that make your project better based on feedback or reflection.
Evaluate is to reflect on what has gone well and what you could improve in a project.
So keep an eye out for those words throughout the lesson.
Remember, they are improve and evaluate.
In today's lesson, improving and sharing, we have two learning cycles.
We have use variables to add a new feature, and improve and evaluate a programme.
Let's start with use variables to add a new feature.
Look at these examples of catching games.
So we have one here with a bowl and apples and a star.
There's got a score and a timer.
How about this one? Okay, we've got some dragons, some broom sticks.
We've got in the corner.
We've got some other variables.
Then we have a different game again, this has got some other variables that you can have a look at.
Last one, we have got some other things happening.
The variables are in different places.
We've got four different examples.
All of them are catching games.
What is similar to the project you created and what is different? Do these games give you any ideas for how you could improve your own game? Some games have a timer.
It could make the game more competitive.
Good answer Andeep.
Definitely having a timer makes you need to get things done before you run outta time.
Laura said she noticed a game with a lives counter that could also add more excitement to the game.
I think you're right, Laura.
Well done.
A lives counter shows how many chances a player has left.
Each time the player misses a falling object, they lose a life.
How could you write this as an algorithm? We could have if the sprite touches the purple border at the bottom of the screen, then decrease the lives counter by one.
To create a variable, open the variables menu and click Make a variable button.
Add the name of your variable.
Make sure it is appropriate for the values that the variable will be storing.
For example, the lives.
Let's have a little check-in.
True or false, this is an appropriate name for a lives counter.
What do you think? Have a go.
How did you get on? I asked you true or false.
This is an appropriate name for a lives counter.
The answer is false.
The name of a variable should reflect the type of value that it will hold.
If you saw this variable with no context, it'd be difficult to know what it is for.
Great job, everyone.
Think about how many lives you want the game to start with.
More lives will make the game easier and fewer lives will make the game more challenging.
It's important to think about your audience who will be playing your game.
Add the set lives block to your setup code.
This code will run at the beginning of the programme to set up the variables.
Sofia said, "The score will be set to zero and the player lives to three." Great job.
That's right.
We want the score to stay being zero.
So then you add to the score as the game goes on.
By setting the lives to three, each player will start with three lives and then as they play, the lives will go down.
Great job Sofia.
Add the changing lives by code to your falling sprites.
Make sure it is within and if then loop so that the sprite starts from the top again after it is touched the bottom of the screen.
I'm using minus one here because the lives need to decrease when the sprite isn't caught and touches the bottom of the screen.
Great job, Andeep.
That's right we want it to be minus one because the lives are going down.
What will happen when lives equal zero.
Izzy says, "When the player runs out of lives, the game will stop." Sofia says, "In my game, I'm also going to change the backdrop to a game over screen." Some great ideas there.
Izzy and Sofia, thank you.
If lives equal zero, then stop the game.
The forever loop will make sure that the condition is being checked all the way through the game.
So we have our code here which says, when the green flags clicked forever, if the lives equal zero then stop all.
Let's have another check in here.
This time, what blocks do I need to code a lives counter? A, switch costumes to lives.
B, set lives to.
C, change lives by.
Or D, lives equal zero.
What do you think? Have a go.
How did you get on? I asked what blocks do I need to code a lives counter? A, switch costume to lives.
B, set lives to.
C, change lives by.
Or D lives equal zero.
The answer.
There are three.
B, set lives to, C, change lives by, and D lives equal zero.
We need all of these blocks to code a lives counter.
Great job everyone.
We are going to move on to task A now.
We're going to add a lives counter to your programme.
Make sure you add set lives to, to set your starting lives.
Add the change lives by block to your falling sprites.
Using a minus number to reduce the lives.
Use a forever loop and at if lives equal zero condition to programme the games ending.
Have a go.
How did you get on? I asked you to add a lives counter to your programme and to make sure you add set lives to, to set your starting lives.
Add the change lives by block to your falling sprites.
Using a minus number to reduce the lives.
And use a forever loop and an if lives equal zero condition to programme the game ending.
Here is my example that you can see by opening oak.
link/catch-2.
And you can see here where my lives and my score appear in the top corner.
Great job everyone.
We are gonna move on learning cycle two now.
Improve and evaluate a programme.
In our project so far we have created a catching game, added a score variable, changed the background and programmed three or more sprites.
What else could be done to improve the game further? Okay, we'll have a little check.
Which of the following are examples of variables? A, score B, sprite, C, time or D, green flag.
What do you think? Have a go.
How did you get on? I asked which of these are examples of variables.
A, score, B, sprite, C, time, or D, green flag.
The answers are A, score and C, time.
Great job everyone.
Laura said, "It would be really good if we could add some more exciting elements to our game." And Sofia has said, "If we added a timer, it would make it more competitive." You're right Sofia.
If we added a timer, people have to get as many points as they can before the timer stops.
Great ideas.
A timer shows how much time a player has left.
The timer will wait one second and then decrease by one.
If the timer value equals zero, then the programme will stop.
How could you write this as an algorithm? So I asked you how could we write this as an algorithm? An algorithm will look a bit like this.
Repeat until the timer equals zero.
Wait one second.
Change timer by minus one.
Great job.
Create a new variable and name it.
Make sure it is appropriate for the values that the variable will be storing.
And this time that will be the timer.
Once the time variable has been created, it'll appear in the menu.
Using the dropdown triangles, any of the variable blocks can be changed to say time.
Think about how much time you would like to give the player.
More time means more opportunities to get a higher score.
Less time makes the game feel more competitive.
It's important to think about your audience who will be playing your game and what they would enjoy.
The time will be counted down in seconds.
This is Andeep's starter code.
He's thinking about his game's audience and how long the timer should be.
So his code says when the green flag clicked, set score to zero.
Set lives to three and set time to 30.
He says, "I would like my game to last 30 seconds.
If I feel it needs a bit longer, I will change the number to 45 seconds." Great job, Andeep And that's right.
We can test what we put in to see how it feels and whether we want longer or shorter.
When you programme the timer, it needs to repeat until the timer equals zero.
It'll wait one second and then take away one from the timer value.
So here we have our code.
When the green flags clicked, set score to zero.
Set lives to three, set time to 30, forever, repeat until time equals zero.
Wait one second, and change time By minus one.
Izzy says, "Your game was too difficult.
I kept losing lives really quickly.
How are you going to make it more fun?" Oh no, Izzy, that's not good.
If a game is too difficult, people won't want to play it.
Andeep has said, "I could look at changing my code, so you only lose lives if the highest scoring sprite misses the bowl." To make a game easier, you could also reduce the number of sprites falling or increase the timer or the amount of lives you have.
When you complete your game, it is time to evaluate.
So you're going to play your game from the beginning.
Does everything work the way you expected? Think about what went well, what are you proud of? Look for ways to improve it next time.
Good programmers always test, improve and evaluate their work in order to make a better programme next time.
let's have a little check.
True or false? Once a game is created and tested, there are no more improvements that can be done.
What do you think? Have a go.
How did you get on? I asked you.
True or false? Once a game is created and tested, there are no more improvements that can be done.
The answer is false.
The reason why, there are always improvements that can be made either to make the game more exciting or to make it play more smoothly.
Great job everyone.
Okay, we are going to move on to task B now.
The first part of task B, I would like you to add a timer to your programme.
Make sure you add set time to set your starting time.
Add the change time by block to the code.
Add in a wait one second block and use a forever loop and a repeat until timer equals zero condition to programme the game counting down.
Have a go.
How did you get on? I asked you to add a timer to your programme and I asked for you to make sure you add set time to set your starting time, add the change time by block to the code.
Add in a wait one second block and use a forever loop and a repeat until timer equals zero condition to programme the game counting down.
You can have a look at my example on the oak.
link/catch-3 Great job.
We have a second part to task B today.
And I would like you to swap games with your partner and evaluate what works well with the game.
Do all sprites work? Is there a clear theme to the sprites and background? What could you do differently or add to the game to improve it? Have a go.
How did you get on? I asked you to swap games with your partner and evaluate what works well with the game.
Do all sprites work? Is there a clear theme to the sprites and background? What could you do differently or add to the game to improve it? Here's what some of the oak children said about their games.
Izzy said, "I really liked how all of your sprites and background matched the space theme." Sofia said, "The timer makes the game really fun and challenging." My high score was 15.
And Laura said, "Next time I would add sound effects when objects are caught." Really useful feedback, thank you.
Well done everyone.
You have worked really hard today.
Let's summarise what we have learned.
You can use variables to improve a project by adding new elements.
A lives counter can be used to track lives and a timer it can be used to track seconds remaining.
Evaluating a coding project is an important part of the process.
This means looking at what has been created, testing it, and looking for what can be improved.
Well done everyone.
You have worked really hard.
I hope to learn with you again soon.