Programming for kids: [lesson #6] let's create a new level

in Steem Kids & Parents2 years ago

photostudio_1661030549543.jpg let's spend more time developing our Sprite jumping Game

Coding With Scratch

Giving the player 3 lives

In the previous lesson, we added a new level to our game which made the game a little more colourful.

Today we will be adding lives to our game. Our jumping cat will now have three lives. At this moment, the game will stop once the cat fails to make a successful jump but we want to give the player the chance to fail three times before the game is over.

This is a sample of what today's learning outcome should be.

What do we need here

  • We will have to edit some sections of the game.
  • When the Crab touches the cat, the game will have a brief stop, and can continue at the press of a button.
  • The brief stop should not reset the score counter the counter will only reset when the player has 3 failed jumps.
  • At each failed jump, the life should have one subtracted.

Some subsystems that could be needed.

  • A system that counts the number of failed jumps.
  • A construct that checks if it's up to 3
  • The game over notification
  • A system that shows the amount of life left.

Loading our previous scratch work

• load the Scratch application
• Move over to the Scratch menu bar.
• Select file.
• Go to 'Load from your Computer'.
• if asked to select an action, select for the folder.
• Chose the appreciate Scratch file.
• This loads our previous work.

Scripting lives into our game

Adding a new variable
We want to add a life variable
• Go to the variable category.
• Select make a variable
• Name it Lives and click ok
photostudio_1661090075057.png

Set-up the Lives counter
Go over to the backdrop where you already have a block which changes the background once the flag is clicked.
We want the lives variable to assume a value of 3 at the start of the game.

photostudio_1661091553174.png

Editing previous scripts
The script originally stated that the game will be over once the Crab 🦀 touched the 🐈 Cat, we want to locate this block of script and edit it.

I found it scripted under the Crab sprite. So I made the needed changes
photostudio_1661093532167.png

The new block states that, whenever the crab should touch the cat, the lives variable should go down by one.

photostudio_1661094968033.png
So I used it...

What happens when life gets to Zero?
When life gets to Zero, this Block gets activated

photostudio_1661096773842.png

It says game over and turns off everything

Testing

I ran several tests and this time I had a lot of bugs and errors. I had to debug a large number of bugs.
One is the fact that the game starts halfway once you click on the flag and it will then stops abruptly before the real game begins.
After signaling game over at the end of the game, the game plays for a minute before it stops.

Debugging is the act of tracing faults that interrupts the smooth running of a program and having them fixed.
photostudio_1661121507094.png

You could also increase the speed of the crab to make the game.
You could add the number of crabs.
You may also drop in a surprise sprite.

Lesson 1Introduction
Lesson 2Getting Started
Lesson 3Animating Your Sprite
Lesson 4keeping a record
Lesson 5The next level

Evaluation

[1.] Identify to the bug responsible for making the game start then stop.
[2.] Make the game wait for a prompt after loosing each lives.
[3.] Identify the reason why the game seem to have more than three lives
[4.] Why is the game still on even after it says game over?.

Rules

- Participants must be verified Steem users
- Parental assistance should be minimal
- The homework post must be > or = 300.
- Post within the steemkids Community.
- Make @steemkidss a beneficiary with 10%.
- You must Identify your club status.
- Entry link should be dropped at the comment section.
- Exemplary performance will be rewarded.
- Use Fintech, technology, steemexclusive, yourcountry, assignment and your club status as part of your hashtag.

Source manuelhooks


Cc
@steemkidss
@ngoenyi
@benton3
@goodybest
@eliany
@patjewell

Written by @manuelhooks for steemkids

fintech steemexclusive learnwithsteem nigeria club100 scratche

Sort:  
Loading...
 2 years ago 

Hola muy bueno para los niños y muy fácil de manejar... Gracias por compartir este contenido...

Coin Marketplace

STEEM 0.21
TRX 0.13
JST 0.030
BTC 66847.77
ETH 3497.61
USDT 1.00
SBD 2.89