Programming for kids: [lesson #5] let's create a new level
let's spend more time developing our Sprite jumping Game
Coding With Scratch
Moving to another level
In our previous lesson, we were able to add a counter to keep count of successful jumps. Now we will love to avoid getting bored after repeatedly jumping over the crab by introducing another level in the game.
I would love the new level to come after jumping the crab 15 consecutive times.
The level will have a few changes introduced in to the game. Please try not to loose focus here, the aim is not to create a jumping game but to show you how to script a program with the Scratch environment.
This is a sample of what we are expected to have at the end of this training.
What do we need here
- We need a second counter that will watch out when the number of successful jumps is 15 in a row so as to initialize the next level.
- We will need some visible effects showing that the level has changed.
- Something that will help reset the counter will have to be put in place. Each time we have a consecutive 15 jumps, the level counter will initiate the move into the next level.
Loading our previous work
• load the Scratch application
• Go over to the Scratch menu bar.
• Select the file option.
• Select 'Load from your Computer'.
• When asked to select an action go for the folder.
• Select the appreciate Scratch file.
• This loads our previous work.
Scripting in a new level
The backdrop
Go to the backdrop button and create a new backdrop
I made the tree backdrop for my level 2Create a script for the backdrop
this runs the plain background at the start of the game.
Creating the Condition
We need a script to
Grab the if then block
Complete the argument by filling in the hexagon with a condition.
- We need to Create an argument for the condition*
• The condition here simple states that:
when the score = 15
We need a score and we have to make it 15.
So we get to the operator category and pull out this block
Move over to variables and drag the score variable into the empty space
This makes the condition read, score = 50 but fifty will be too much. So we will change the value in the second circle from 50 to 15
Having Changed the value here to correspond with the number of consecutive jumps needed to activate a next level which is 15 in this case.
Our argument for the condition block is created
Now we will place the argument in the if then block.
Get to the event category and pull out the broadcast block
Drop the arrow, select new message and type in Level 2
Place the message block into the if loop to complete our condition
The condition block will be responsible for triggering the switch to level 2
Updating the cat sprite
The condition block is fixed into the script of the cat sprite
Connecting the dots
We can now go back to the backdrop sprite and add the response to the level 2 message
The new block says, when I receive the level 2 message, change the backdrop to tree
Which is a visible evidence that we have made a new landmark.
Testing
When I ran the test, I got this once I made my fifteenth jump...
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 1 | Introduction |
Lesson 2 | Getting Started |
Lesson 3 | Animating Your Sprite |
Lesson 4 | keeping a record |
Lesson 5 | The next level |
Evaluation
[1.] Can it display "the level number", wait a bit before starting.
[2.] How would you add level 3 to the game.
[3.] Add another crab to make it two.
[4.] Try making the Crab to move a little faster.
[5.] Explain how to accomplished each task and it's challenges.
Rules
- All participants must be verified kids
- This homework is for the kids and Not the parents
- The homework post should be = or > 300 .
- Post in the steemkids Community.
- Make @steemkidss a beneficiary with at least 10%.
- You must belong to club50 club75 or club100
- Drop your entry link at the comment section.
- All participants who perform well will be rewarded.
- Use the tags learnwithsteem and 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
Note: You must enter the tag #fintech among the first 4 tags for your post to be reviewed.
Another great lesson!
Thank you!
Congratulations, your post has been supported by @steem4nigeria. This is the official community account of Nigerians on Steemit. You can reach us here on our community account.
Discord Facebook Twitter