SlideShare a Scribd company logo
1 of 212
Download to read offline
Scoring
Week# 5
Sunday
28
March
2021
Abia, USA
9 am IST
Nardos, USA
Coolest Projects Competition
Registration is OPEN!
You can register to share your
creations in Raspberry Pi's
world-leading online tech showcase!
Raspberry Pi welcomes projects
from anywhere in the world,
whatever your experience level!
https://online.coolest
projects.org/
Reminder
Please be respectful and
appropriate with your
responses in the chat!
Week 5
● Never miss an
episode!
● Get Notified
of new shows!
CodeTigers
SUBSCRIBE
1. Introductions
2. Week 4 Studio Time!
3. Scoring Project
4. Game Time!
5. Next Week’s Class
What you will learn
1. Add scores to your game!
2. Using the sensing blocks!
Meet the Mentors!
Starting with Scratch:
Mera
@MeraSeifu
Noora
@nooraabed
Abia
@abiazahir
Tanisha
@TanishaD11
Emanda
@emandaseifu
Vagish
@vagish
Pallab
@Pallab_Layak
Soham
@SohamDasgupta91
Nardos
@nardosd
Virginia, USA 12th grade
Creating DIY crafts & Baking
Virginia, USA 11th grade
Listening to music & watching netflix
@MPSIronAnt
@shridev
@Coding
@Unique2006573
Queen3919
Excellent job!
5. Mistressbrain
6. pranavsh09
7. siddhant11jan
8. dimondowl
9. MegaTanishK
10. Jansh1102
11. Coding2705
12. BELAKU
13. swswi
14. Coder_Shlok_Pro
Coolest Projects Competition
https://online.coolestprojects.org/projects/362
SPACE CLEAN UP
INSTRUCTIONS
Use Your Arrow Keys.
Coolest Projects Celebration!!
When will we
see which
projects are
picked as
favorites? June 8, 2021!
Using Variables
But first...
Shoutout to Zoe from the Scratch Team!
The Hungry Hare
game is based off
of Zoe’s game!:
https://www.youtu
be.com/watch?v=1j
HvXakt1qw
Last week, your mentors helped to create
‘HareGame(Name)’
Today, we’ll be adding score to our game!
Today, we WON’T
create a new file...
...we WILL use last
week’s project!
(Self-created OR Remix)
Project #1 File Naming Protocol
HareGame(Your first name)
● Example:
HareGameMera
***From LAST week!***
Live
Demonstration
Time!!!
Log into Scratch
Click on your Name icon and the ‘My Stuff’
button down below
Click on your ‘HareGame’ game first.
See inside’ Project from last week
….then click on the “Inside” button
Not here last week? No problem!
Here’s the link to the studio for today’s session:
Scratch Studio - India Scratch: Class #5-Scoring (mit.edu)
To Remix last week’s project go to Mera’s file in Class #5 Studio and
click to open...
...then click on the green “Remix” button and...
Rename the game
Scoring(Your first name)
● Example:
ScoringNardos
Your screen should now look like this:
Demo
Over
Why Create A Score?
It will help count our points!
Ball Sprite Points: 0 Strawberry Sprite Points: +1
1 2 3
. . .
So how do we create a Score?
We have to
create a
variable!
X + 2 = 6
(x is the variable)
a + b
(symbolic representations
of any number)
But first, what is a Variable?
But first, what is a Variable?
● Variables are data values (i.e. numbers, names) that can change when
the program is asked a question, for example, age/birthday, etc.
● A variable is a storage location paired with an associated symbolic
name (an identifier) which contains a value
● A variable is a storage location for data
But first, what is a Variable?
● Variables are data values (i.e. numbers, names) that can change when
the program is asked a question, for example, age/birthday, etc.
● A variable is a storage location paired with an associated symbolic
name (an identifier) which contains a value
● A variable is a storage location for data
What??
Variable Explained: Characters
Programmer Variable Event
YOU!
Variable Explained: Your Mission
Programmer
YOU!
● You want to invite your friends to your birthday party.
● You want each of your friends to feel special so you
want the invitations to have their names on it!
● You are inviting 10 friends but don’t want to write out
everybody name
○ ouch! Your hand would hurt!
○ the postal service is SO s-l-o-w
○ it’s COVID! You can’t just give it to them in
person!.......
Variable Explained: Your Mission
Programmer
YOU!
● You want to invite your friends to your birthday party.
● You want each of your friends to feel special so you
want the invitations to have their names on it!
● You are inviting 10 friends but don’t want to write out
everybody name
○ ouch! Your hand would hurt!
○ the postal service is SO s-l-o-w
○ it’s COVID! You can’t just give it to them in
person!.......
What should
you do??
Variable To the rescue!
That’s ok
programmer!
I can help
you!
I am a
coding
superhero!
Variable To the rescue!
Really?
How does
that work?
Let me tell
you a
story...
YOU!
Variable Explained
● I am a storage location for data
Storage
Location
What is my
value?
Who
Am I?
What data
am I
responsible
for storing?
Variable Explained
● I am a storage location that gets paired with an associated
symbolic name (an identifier) which contains a value
Variable Defined
Really!
You can
make me
anything
you can
imagine!
YOU!
A
name... A
date...
Variable Defined I have a birthday
party coming up -
how could you help
me with that?
YOU!
Variable Defined
Yes
YOU!
You have friends
you want to invite
to the party, right?
Variable Defined
Really! That
sounds
wonderful!
YOU!
Well you can name me (give
me a value) and I can save
you the trouble of
handwriting every invitation! Please
show
me
how...
Variable Defined
OK
YOU!
Let’s call me: Name
(to represent the name of
each of your friends)
Name
Variable Defined Here are the
names of
my friends
YOU!
Diya
Kevin
Navaneeth
Nikita
Usra
Aadil
Pratyush
Ayaann
S.K. Sowmya
Arnav
Variable Defined
Great!!
Name
● A variable is a storage
location paired with an
associated symbolic
name (an identifier)
which contains a value
storage
location
Name
symbolic name
(an identifier)
So the way you turn
on my superpowers
is as follows:
Name
Step # 1:
Go to the variable menu...
And click on Make a Variable
So the way you turn
on my superpowers
is as follows:
Name
Step # 2:
1. Give me my “symbolic name”
2. Leave the variable marked
“For all sprites”
3. Click on “OK”
1
2 3
1.
2.
3.
Name
Name
Step # 3:
● you can see my “symbolic
name” on the taskbar
Variables
I can use my
superpowers for
you when…...
WARNING!
Make sure you know if you want the variable to
show or no-show! Your choice!
Using a Variable
YEAAAaaa!
YOU!
Now we can start filling
out your invitations!!!
Name
So the way you turn
on my superpowers
is as follows:
Name
Go to the variable toolbar and get
the “set my variable to () block
Then make the “0” = the name of
your friend!
Variable Defined Let’s make
one for Diya
first!
YOU!
Diya
Kevin
Navaneeth
Nikita
Usra
Aadil
Pratyush
Ayaann
S.K. Sowmya
Arnav
OK! Let make a
birthday card for
Diya! First...
Name
Then make the “0” = Diya!
(because we want her to be
displayed on the birthday card)
Step # 1:
second... choose
the symbolic name
for the variable!
Name
Then choose the symbolic name
for me = “name”
Step # 2:
Now let’s look at the
Birthday Card as we
have it in the
Scratch program!
Name
Place
for
Name
Place
for
Name
Now for my
super
powers!!!!!!!!
Name
Name
1. Diya’s name shows up in both places
2. ...at the same time
3. ...and you didn’t write anything by hand!!!!
WOW!
YOU!
HOW?
YOU!
Show & Tell: Birthday Card Sprite
No code required! It just site in the
background looking great!
HOW?
YOU!
Show & Tell: Balloon Sprite
Code translation: The “Name” variable, set to
“Diya” is going to show for “7” seconds
HOW?
YOU!
Show & Tell: Party Hat Sprite
Code translation: The “Name” variable, set to
“Diya” is going to show for “7” seconds
Wait! You are using
the same code for
the balloon AND
the party hat?
YOU!
Show & Tell: Tale of 2 Sprites
Code translation: The “Name” variable, set to
“Diya” is going to show for “7” seconds
Show & Tell: Tale of 2 Sprites
Code translation: The “Name” variable, set to
“Diya” is going to show for “7” seconds
YES! That
is the
superpower
of a variable!
Name
End of the Story!
Now I know how to
make a birthday
card for each one of
my friends!
YOU!
Excellent! Glad I could
help! Call on me anytime!
My superpowers are
always available!
Name
Now let’s go
back and apply
our knowledge
about variables
to adding a
score to the
HareGame!
My superpowers
are always
available!
Name
Let’s review: There were 4 steps to making this game...
1 2
3 4
Make the
hare jump
Make the
game
obstacle
Make the
strawberry
for the
hare to eat!
Make the
hare move
STEP 1
STEP 3
STEP 2
STEP 4
Let’s review: Step #1 & #2 are not related to scoring;
they deal with costume details.
On the other hand, the ball and strawberry cause things
happen to in the game. Let’s look closer…..
3 4
Make the
game
obstacle
Make the
strawberry
for the
hare to eat!
STEP 3 STEP 4
Objective of Strawberry
How is the strawberry an
advantage in the game?
If the hare touches the
strawberry the game
continues.
The strawberry = ONE
point.
Objective of Ball
How is the ball a
challenge in the game?
If the hare touches
the ball the game will
stop.
The ball = ZERO
points.
Objective of The Hare
The hare is the
trigger
(conditional) for
when the score
increases or
stops the game.
What is the hare’s
role in the game?
Live
Demonstration
Time!!!
Objective of Strawberry
How is the strawberry an
advantage in the game?
If the hare touches the
strawberry the game
continues.
The strawberry = ONE
point.
Objective of Ball
How is the ball a
challenge in the game?
If the hare touches
the ball the game will
stop.
The ball = ZERO
points.
Objective of The Hare
The hare is the
trigger
(conditional) for
when the score
increases or
stops the game.
What is the hare’s
role in the game?
● Now that we have reviewed the details
of the game let’s get ready to start
coding our score!
● Does the hare Sprite need a coding
variable?
○ NO! Because it is the trigger
(conditional) of the action
○ We need to code the score where
counting happens!
■ Ball = 0, stops game
■ Strawberry = +1 to score
Objective of Strawberry
How is the strawberry an
advantage in the game?
If the hare touches the
strawberry the game
continues.
The strawberry = ONE
point.
Objective of Ball
How is the ball a
challenge in the game?
If the hare touches
the ball the game will
stop.
The ball = ZERO
points.
Objective of The Hare
The hare is the
trigger
(conditional) for
when the score
increases or
stops the game.
What is the hare’s
role in the game?
● Let’s make the
game better by
telling the player
what is going on
when the hare
touches the ball.
● Solution: make a
“GAME OVER”
backdrop if/when
the hare touches
the ball
● When you play
the game it stops
if/when the hare
touches the ball
● No additional
coding required
to “not” add
points to the
game
Review Code
Let’s make the game more “user-friendly” and let
players know when the game is over!
To do that we’re going to create a “GameOver” backdrop
Click on the Stage and then Backdrops
1
2
1 2
Next we can make a copy of the “BlueSky” backdrop and
use it, with modifications, for our “GameOver” backdrop
To do this, we
1. right-click on the
backdrop and
2. click on the
“duplicate” button
Now, let’s rename the file to “GameOver,” so we
know which backdrop it is when we code.
TIP:
● Always name coding
elements based on what
makes them unique!
● This habit allows you to
remember what the
element looks like when
you choose them name
on a coding menu!
With our backdrop costume named we can begin to
modify the backdrop to “talk” to the player of the game.
● Clicking the “T”
(for Text) on the
tools menu
● Type “Game Over!”
Have fun looking at different text colors!
We can change the text font type and/or the
size of the font! So many options!
Let’s write a second line of text telling the
player how to reset the game!
Challenge!
Choose a different
font for the second
text
Hummm...where should we code the “GameOver”
backdrop? The hare, the ball, or the strawberry?
The ball! Why?
The Ball Sprite
has the code
that causes the
game to STOP!
When do we want our “GameOver” backdrop to show?
● Before the game stops!
● So we’ll need to place the
“switch backdrop to()” block
+ “GameOver backdrop in the
code before everything stops
( )
Oh No! The game is still running while the
“GameOver” backdrop is up!
Correct Incorrect
beginning backdrop beginning backdrop
How do we fix that? We need the game to start on
the BlueSky backdrop - so let’s code that in!
*NOTE: Place the
backdrop just after the
“when green flag clicked”
block so the backdrop
always appears in the start
of the game
Great problem solving! The appropriate backdrops
are displayed at the correct time - the code works!
Start of the
game backdrop
Correct
End of the game
backdrop
Correct
Objective of Strawberry
How is the strawberry an
advantage in the game?
If the hare touches the
strawberry the game
continues.
The strawberry = ONE
point.
Objective of Ball
How is the ball a
challenge in the game?
If the hare touches
the ball the game will
stop.
The ball = ZERO
points.
Objective of The Hare
The hare is the
trigger
(conditional) for
when the score
increases or
stops the game.
What is the hare’s
role in the game?
● When the hare touches (eats) the
strawberry it earns a point!
● We need create code that adds
points to the score (+1) when the
hare touches the strawberry
Score: 0 Score: +1
Let’s use the 3-step process we just learned create the variable that
will allow the strawberry to add 1 point when touched by the hare.
Make sure you are on the strawberry’s workspace!
How to make a
variable….
Step # 1:
Go to the variable menu...
And click on Make a Variable
Step # 1:
1) Go to variable menu
2) Click on “Make a Variable
So the way you turn
on my superpowers
is as follows:
Score
Step # 2:
1. Choose a “symbolic name”
2. Leave the variable marked
“For all sprites”
3. Click on “OK”
1
2 3
1.
2.
3.
Score
Step # 2:
1) Choose a “symbolic name”
2) Leave the variable marked “For all Sprites”
3) Click on “OK”
“For all sprites:” This is the
default choice. All Sprites can
see and use this variable.
“For this sprite only:” Variable can
only be used by 1 sprite. The
restriction is labeled.
TIP! *Make a mistake with a variable?
*Want to rename of delete?????
Right click on the variable itself
When you are selecting a variable
Score
Step # 3:
● you can see my “symbolic
name” on the taskbar
I can use my
superpowers for
you when…...
Variables
WARNING!
Make sure you know if you want the variable to
show or no-show! Your choice!
Your screen should look like this
The hare earns a
point every time it
touches (eats) a
strawberry!
Score
The game is set to start at zero.
Once the hare touches a
strawberry we need to increase
our variable “score” by 1
Step # 1:
Go to the variable toolbar
and get the
“change my variable by () block
second... choose
the symbolic name
for the variable!
Name
Change the symbolic name of the
variable to “score”
Step # 2:
Now you should see your score add by 1!
The game is complete!? YES!!!!!!
Score
Objective of the Balloon Popping Game
1. The game is to
touch the
moving balloon.
2. Each balloon =
ONE point (+1)
is added to the
score.
Creating a File
Project #2: File Naming Protocol
BalloonPopping(Your first name)
● Example:
BalloonPoppingAbia
BalloonPoppingNardos
Name the project “BalloonPopping(Name)”
Delete the sprite we won’t be using...
...and get the balloon sprite so we can pop it in our game!
Click on “choose a sprite”
Your screen should look like this
Use the search bar to
search for a balloon!
Now, we are ready
for coding!
Have you heard of
video sensing?
Video Sensing
Video sensing definition
● Video sensing is computer software
that tracks motion (and sometimes
color) through video
○ The computer looks at the images in a video frame
by frame!
● Allows the computer to perform
actions on virtual objects based on
YOUR movement!
○ Just like the filters that move on apps like
Snapchat, Instagram and more
Hmmm...I wonder if there’s a way to play
with video sensing in Scratch?
There’s a way to do it! Scratch has many
extensions that allow you to expand your skills
Let’s use Video Sensing blocks in
Scratch!
Video Sensing
To start, click on
the extensions
button in the
bottom left corner
Click on the extension“Video
Sensing”
Steps access video sensing
1 2
Now we got 4 video sensing blocks
Let’s turn our video on!
OH NO! Nothing happens and we still
don’t see our video
In order to use your camera, Scratch needs
permission to access it.
1. Click on the camera icon with an on
the website URL tab
2. The tells us that camera is blocked
3. This icon allows you to grant the website
permission to use your video
Select the “always allow” option and click done
Scratch CAN’T access camera Scratch CAN access camera
https://support.microsoft.com/en-us/windows/turn-on-app-permissions-for-your-camera-in-windows-10-87ebc757-1f87-7bbf-84b5-0686afb6ca6b
Permission to use camera-Microsoft
WAIT!! Notice this message
● The camera might not
immediately work
● To fix this, reload the
page
“This page may need to be reloaded
before the new settings take effect.”
Hmmm..we still can’t see the camera, let’s play with the
video sensing blocks one by one and see what happens...
Grr...We still don’t see anything!!!! I wonder if
something will happen when I move around...
YEAAH!!! It works!
● When the amount of movement a person makes
is greater than the selected number….
○ The code that follows will run
● Goes from 0 to 100
○ 0: Don’t need much movement
○ 100: Needs a lot of movement
Let’s look at what else we can do with the video.
The drop down menu shows us options, I’m going to
try selecting “off”
● We use the green flag because we’ve
always started our code with before
● The green flag “activates” or runs our code
● But our code for this activity does not have
this block… So How do we test our code?
In the past we have been testing
code using the green flag...
● Our code starts with the dd
block
● So now our code is activated and runs
when the computer detects our
movements!
Tip: test your code by moving around!
The video is gone!
The code is
working
What happens when we turn video “on flipped”?
Let’s compare what we are seeing! Our video is now flipped
Scratch Video Options
I’m going to choose to leave the turn video block on
Hmm..this block is different. We can’t just add it
to our code because it’s round
Tip: We can use round blocks in the round
editable areas of other blocks
Example:
What does this code do?
The balloon moves away everytime you touch it!
BEFORE we run our code AFTER we run our code
What if we change it to stage?
The balloon still moves away!
BEFORE we run our code AFTER we run our code
● Allows the computer to perform actions on
a sprite or stage based on YOUR movement!
● Needs to be added to another block in
order to work
I’m going to get rid of that code and move the ballon closer to the
middle of the stage because I want the balloon back for the game
Let’s see what the last video sensing block does..
I can’t see any changes...
Let’s try changing the number..
Look at the difference!
I like the way it was before so I’m going to keep the
transparency at 50. You can do whatever you like! This is
something to personalize to your tastes and the
capabilities of your computer!
WOOHOO, that was FUN!! Now you know
how video sensing works in Scratch!
Objective of the Balloon Popping Game
1. The game is to
touch the
moving balloon.
2. Each balloon =
ONE point (+1)
is added to the
score.
1. The game is to touch the moving balloon.
● The balloon isn’t moving yet
● How can we move the ballon?
○ What if we have it go to random places on stage
How can we move the ballon?
We can use this
block!
● Moves our sprite to
random places on the
stage
● You (as the
programmer) can’t
predict where the
sprite will be next
Under the “motions” tab, drag the “go to random
position” block to your code
LOOK! The balloon is all around the stage
Objective of the Balloon Popping Game
1. The game is to
touch the
moving balloon.
2. Each balloon =
ONE point (+1)
is added to the
score.
2. Each balloon = ONE point (+1) is added to the score
● We need to keep track of points
● How can we store and keep track of values?
1
1 1
1
1
1
1
1
1
To do this, we need to create a variable!
● Purpose: store the
value of how many
points the player
scores
● Identifier: “score”
score
How can I use my
superpowers for
you?
Step # 1:
1) Go to variable menu
2) Click on “Make a Variable
Step # 2:
Score
1. Choose a “symbolic
name”
2. Leave the variable
marked “For all
sprites”
3. Click on “OK”
1.
2.
3.
2
3
Now the variable shows up! Make sure the blue
check next to the score variable is clicked
Objective of the balloon
When we “pop” the balloon, we get one point!!!
What is the balloon’s role in the game?
Let’s change score by 1
Our score isn’t changing!
REMINDER: Use the drop down on the change
block and select the “symbolic name” which
in this case is “score”
It works!
Hmm… wouldn’t it be nice to have popping
sounds to the balloon… Let’s add sound
This block will play the pop
sound
*Everytime motion is detected on the
balloon, it will make a “Pop” sound like
bubblegum!
Now we can hear the balloon pop
before it gets to new location on the
stage!!
Add the “play sound until done” block and move around to see
if it works...
WAIT!!!
● The scores keeps going up and up!
● What if I wanted to play with my
friend?
○ Hmm..I don’t want my friend to
continue using my own score
○ At what point will can the
player restart the score from 0
Change “my variable” to “score”
OH NO! Now the score is always 0!
Let’s try setting the score to 0 when the green flag is clicked
YEAH! It works now, but it’s a
little fast and I wonder if the
game can run smoother...
I remember seeing Ms.D’s code and I
liked that her score went increased
slower. Let’s try what she did
Even though we are not remixing the project, we
are ethical coders so we have to give Ms.D credit!
Thanks to Ms.D for her help!
It is like the If statement is the cause, the then statement is the effect
If: It was raining Then: I used an umbrella
● “If - then” bocks tell the computer to perform
an action when a condition is true
● The score goes up only when the computer detects
movement greater than 5 on the sprite (condition)
Drag the “if then” block to your code
To add the > sign, let’s go under “operators” and drag the block with the
pointy edges that will fit in the condition of the “if-then” block
Now we can add the video sensing block we need to the condition
The game works much better!
Let’s change it up and have the
balloon change colors
● I want to dance and play
with music!
● Let’s add some background
music by going to the
“sounds” tab
FUN!!! The color changes and I have a brilliant idea...
Let’s choose some music
Look at all the sound clip options!
I’m going to try out the sounds under “loops”
I like “Dance Sitar”, you can pick whichever one you like
Play the sound and test the game
● I think the music is too loud so I want it to be a little quieter
○ Use the “softer” button to do this
Under the code tab, add “another green flag
clicked” block the “play sound until done” block
OH NO! I want to keep playing but the music
stopped
● We want the music to
keep playing until we
leave the game
● Let’s use a forever
block which will repeat
the action again and
again and again!
YEAHH! Our game is completed!
Save and share your project, then put it in this
week’s studio
Don’t forget to give Ms.D credit
Demo
Over
www.menti.com
Code: 7263 1010
Coolest Projects Competition
https://online.coolest
projects.org/
Registration is OPEN!
You can register to share your
creations in Raspberry Pi's
world-leading online tech showcase!
Raspberry Pi welcomes projects from
anywhere in the world, whatever your
experience level!
Check out your
class resources!
The links are in
the YouTube
description!
Don’t forget to…..
● Never miss an
episode!
● Get Notified
of new shows!
CodeTigers
SUBSCRIBE
Scratch Lesson 6:
Creative Coding!
(FUN-ctions!)
Join us next week for…..
Class #5: Scoring

More Related Content

More from Angela DeHart

Tanisha Dhami's resume
Tanisha Dhami's resumeTanisha Dhami's resume
Tanisha Dhami's resumeAngela DeHart
 
Pallab Layak's resume
Pallab Layak's resumePallab Layak's resume
Pallab Layak's resumeAngela DeHart
 
HackSIP 2 Activity Flyer
HackSIP 2 Activity FlyerHackSIP 2 Activity Flyer
HackSIP 2 Activity FlyerAngela DeHart
 
Class #7: Here's the Scoop
Class #7: Here's the ScoopClass #7: Here's the Scoop
Class #7: Here's the ScoopAngela DeHart
 
Register for the Coolest Project Competition!
Register for the Coolest Project Competition!Register for the Coolest Project Competition!
Register for the Coolest Project Competition!Angela DeHart
 
Class #8: Kites, Cookies, or Samosas
Class #8: Kites, Cookies, or SamosasClass #8: Kites, Cookies, or Samosas
Class #8: Kites, Cookies, or SamosasAngela DeHart
 
Class #6: Fun-ctions
Class #6: Fun-ctionsClass #6: Fun-ctions
Class #6: Fun-ctionsAngela DeHart
 
Coolest Project Competition
Coolest Project CompetitionCoolest Project Competition
Coolest Project CompetitionAngela DeHart
 
Class #2: Storytelling
Class #2: StorytellingClass #2: Storytelling
Class #2: StorytellingAngela DeHart
 
Angela DeHart Resume
Angela DeHart ResumeAngela DeHart Resume
Angela DeHart ResumeAngela DeHart
 
Class #1: Introduction
Class #1: IntroductionClass #1: Introduction
Class #1: IntroductionAngela DeHart
 
Class #1: Blocks and Vocabulary
Class #1: Blocks and VocabularyClass #1: Blocks and Vocabulary
Class #1: Blocks and VocabularyAngela DeHart
 
Newsletter Vol1-Issue 6
Newsletter Vol1-Issue 6Newsletter Vol1-Issue 6
Newsletter Vol1-Issue 6Angela DeHart
 
"Scratch"-ed Activities: HackSIP, Hour of Code, BRIGHT-CS
"Scratch"-ed Activities:  HackSIP, Hour of Code, BRIGHT-CS"Scratch"-ed Activities:  HackSIP, Hour of Code, BRIGHT-CS
"Scratch"-ed Activities: HackSIP, Hour of Code, BRIGHT-CSAngela DeHart
 

More from Angela DeHart (20)

Tanisha Dhami's resume
Tanisha Dhami's resumeTanisha Dhami's resume
Tanisha Dhami's resume
 
Pallab Layak's resume
Pallab Layak's resumePallab Layak's resume
Pallab Layak's resume
 
2020 Noora Aabed
2020 Noora Aabed2020 Noora Aabed
2020 Noora Aabed
 
STEM Calendar
STEM CalendarSTEM Calendar
STEM Calendar
 
HackSIP 2 Activity Flyer
HackSIP 2 Activity FlyerHackSIP 2 Activity Flyer
HackSIP 2 Activity Flyer
 
Class #7: Here's the Scoop
Class #7: Here's the ScoopClass #7: Here's the Scoop
Class #7: Here's the Scoop
 
Register for the Coolest Project Competition!
Register for the Coolest Project Competition!Register for the Coolest Project Competition!
Register for the Coolest Project Competition!
 
Class #8: Kites, Cookies, or Samosas
Class #8: Kites, Cookies, or SamosasClass #8: Kites, Cookies, or Samosas
Class #8: Kites, Cookies, or Samosas
 
Class #6: Fun-ctions
Class #6: Fun-ctionsClass #6: Fun-ctions
Class #6: Fun-ctions
 
Coolest Project Competition
Coolest Project CompetitionCoolest Project Competition
Coolest Project Competition
 
Abia Zahir
Abia ZahirAbia Zahir
Abia Zahir
 
Class #3: Sounds
Class #3: SoundsClass #3: Sounds
Class #3: Sounds
 
Class #2: Storytelling
Class #2: StorytellingClass #2: Storytelling
Class #2: Storytelling
 
Angela DeHart Resume
Angela DeHart ResumeAngela DeHart Resume
Angela DeHart Resume
 
Class #1: Introduction
Class #1: IntroductionClass #1: Introduction
Class #1: Introduction
 
Class #1: Blocks and Vocabulary
Class #1: Blocks and VocabularyClass #1: Blocks and Vocabulary
Class #1: Blocks and Vocabulary
 
Newsletter Vol1-Issue 6
Newsletter Vol1-Issue 6Newsletter Vol1-Issue 6
Newsletter Vol1-Issue 6
 
"Scratch"-ed Activities: HackSIP, Hour of Code, BRIGHT-CS
"Scratch"-ed Activities:  HackSIP, Hour of Code, BRIGHT-CS"Scratch"-ed Activities:  HackSIP, Hour of Code, BRIGHT-CS
"Scratch"-ed Activities: HackSIP, Hour of Code, BRIGHT-CS
 
Nardos Resume
Nardos ResumeNardos Resume
Nardos Resume
 
Mera Seifu Resume
Mera Seifu ResumeMera Seifu Resume
Mera Seifu Resume
 

Recently uploaded

Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4JOYLYNSAMANIEGO
 
TEACHER REFLECTION FORM (NEW SET........).docx
TEACHER REFLECTION FORM (NEW SET........).docxTEACHER REFLECTION FORM (NEW SET........).docx
TEACHER REFLECTION FORM (NEW SET........).docxruthvilladarez
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxlancelewisportillo
 
EmpTech Lesson 18 - ICT Project for Website Traffic Statistics and Performanc...
EmpTech Lesson 18 - ICT Project for Website Traffic Statistics and Performanc...EmpTech Lesson 18 - ICT Project for Website Traffic Statistics and Performanc...
EmpTech Lesson 18 - ICT Project for Website Traffic Statistics and Performanc...liera silvan
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxVanesaIglesias10
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptxmary850239
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmStan Meyer
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfVanessa Camilleri
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
Millenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptxMillenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptxJanEmmanBrigoli
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
Dust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSEDust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSEaurabinda banchhor
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfPatidar M
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptshraddhaparab530
 

Recently uploaded (20)

Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4
 
TEACHER REFLECTION FORM (NEW SET........).docx
TEACHER REFLECTION FORM (NEW SET........).docxTEACHER REFLECTION FORM (NEW SET........).docx
TEACHER REFLECTION FORM (NEW SET........).docx
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
 
EmpTech Lesson 18 - ICT Project for Website Traffic Statistics and Performanc...
EmpTech Lesson 18 - ICT Project for Website Traffic Statistics and Performanc...EmpTech Lesson 18 - ICT Project for Website Traffic Statistics and Performanc...
EmpTech Lesson 18 - ICT Project for Website Traffic Statistics and Performanc...
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptx
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and Film
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdf
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
Millenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptxMillenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptx
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
Dust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSEDust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSE
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.ppt
 

Class #5: Scoring

  • 2. Coolest Projects Competition Registration is OPEN! You can register to share your creations in Raspberry Pi's world-leading online tech showcase! Raspberry Pi welcomes projects from anywhere in the world, whatever your experience level! https://online.coolest projects.org/
  • 3. Reminder Please be respectful and appropriate with your responses in the chat!
  • 4.
  • 6. ● Never miss an episode! ● Get Notified of new shows! CodeTigers SUBSCRIBE
  • 7. 1. Introductions 2. Week 4 Studio Time! 3. Scoring Project 4. Game Time! 5. Next Week’s Class
  • 8. What you will learn 1. Add scores to your game! 2. Using the sensing blocks!
  • 11. Virginia, USA 12th grade Creating DIY crafts & Baking
  • 12. Virginia, USA 11th grade Listening to music & watching netflix
  • 14. Excellent job! 5. Mistressbrain 6. pranavsh09 7. siddhant11jan 8. dimondowl 9. MegaTanishK 10. Jansh1102 11. Coding2705 12. BELAKU 13. swswi 14. Coder_Shlok_Pro
  • 16. Coolest Projects Celebration!! When will we see which projects are picked as favorites? June 8, 2021!
  • 17.
  • 19. But first... Shoutout to Zoe from the Scratch Team! The Hungry Hare game is based off of Zoe’s game!: https://www.youtu be.com/watch?v=1j HvXakt1qw
  • 20. Last week, your mentors helped to create ‘HareGame(Name)’
  • 21. Today, we’ll be adding score to our game!
  • 22. Today, we WON’T create a new file... ...we WILL use last week’s project! (Self-created OR Remix)
  • 23. Project #1 File Naming Protocol HareGame(Your first name) ● Example: HareGameMera ***From LAST week!***
  • 26. Click on your Name icon and the ‘My Stuff’ button down below
  • 27. Click on your ‘HareGame’ game first. See inside’ Project from last week
  • 28. ….then click on the “Inside” button
  • 29. Not here last week? No problem! Here’s the link to the studio for today’s session: Scratch Studio - India Scratch: Class #5-Scoring (mit.edu) To Remix last week’s project go to Mera’s file in Class #5 Studio and click to open...
  • 30. ...then click on the green “Remix” button and...
  • 31. Rename the game Scoring(Your first name) ● Example: ScoringNardos
  • 32. Your screen should now look like this:
  • 34. Why Create A Score? It will help count our points! Ball Sprite Points: 0 Strawberry Sprite Points: +1 1 2 3 . . .
  • 35. So how do we create a Score? We have to create a variable! X + 2 = 6 (x is the variable) a + b (symbolic representations of any number)
  • 36. But first, what is a Variable?
  • 37. But first, what is a Variable? ● Variables are data values (i.e. numbers, names) that can change when the program is asked a question, for example, age/birthday, etc. ● A variable is a storage location paired with an associated symbolic name (an identifier) which contains a value ● A variable is a storage location for data
  • 38. But first, what is a Variable? ● Variables are data values (i.e. numbers, names) that can change when the program is asked a question, for example, age/birthday, etc. ● A variable is a storage location paired with an associated symbolic name (an identifier) which contains a value ● A variable is a storage location for data What??
  • 40. Variable Explained: Your Mission Programmer YOU! ● You want to invite your friends to your birthday party. ● You want each of your friends to feel special so you want the invitations to have their names on it! ● You are inviting 10 friends but don’t want to write out everybody name ○ ouch! Your hand would hurt! ○ the postal service is SO s-l-o-w ○ it’s COVID! You can’t just give it to them in person!.......
  • 41. Variable Explained: Your Mission Programmer YOU! ● You want to invite your friends to your birthday party. ● You want each of your friends to feel special so you want the invitations to have their names on it! ● You are inviting 10 friends but don’t want to write out everybody name ○ ouch! Your hand would hurt! ○ the postal service is SO s-l-o-w ○ it’s COVID! You can’t just give it to them in person!....... What should you do??
  • 42. Variable To the rescue! That’s ok programmer! I can help you! I am a coding superhero!
  • 43. Variable To the rescue! Really? How does that work? Let me tell you a story... YOU!
  • 44. Variable Explained ● I am a storage location for data Storage Location
  • 45. What is my value? Who Am I? What data am I responsible for storing? Variable Explained ● I am a storage location that gets paired with an associated symbolic name (an identifier) which contains a value
  • 46. Variable Defined Really! You can make me anything you can imagine! YOU! A name... A date...
  • 47. Variable Defined I have a birthday party coming up - how could you help me with that? YOU!
  • 48. Variable Defined Yes YOU! You have friends you want to invite to the party, right?
  • 49. Variable Defined Really! That sounds wonderful! YOU! Well you can name me (give me a value) and I can save you the trouble of handwriting every invitation! Please show me how...
  • 50. Variable Defined OK YOU! Let’s call me: Name (to represent the name of each of your friends) Name
  • 51. Variable Defined Here are the names of my friends YOU! Diya Kevin Navaneeth Nikita Usra Aadil Pratyush Ayaann S.K. Sowmya Arnav
  • 52. Variable Defined Great!! Name ● A variable is a storage location paired with an associated symbolic name (an identifier) which contains a value storage location Name symbolic name (an identifier)
  • 53. So the way you turn on my superpowers is as follows: Name Step # 1: Go to the variable menu... And click on Make a Variable
  • 54. So the way you turn on my superpowers is as follows: Name Step # 2: 1. Give me my “symbolic name” 2. Leave the variable marked “For all sprites” 3. Click on “OK” 1 2 3 1. 2. 3. Name
  • 55. Name Step # 3: ● you can see my “symbolic name” on the taskbar Variables I can use my superpowers for you when…...
  • 56. WARNING! Make sure you know if you want the variable to show or no-show! Your choice!
  • 57. Using a Variable YEAAAaaa! YOU! Now we can start filling out your invitations!!! Name
  • 58. So the way you turn on my superpowers is as follows: Name Go to the variable toolbar and get the “set my variable to () block Then make the “0” = the name of your friend!
  • 59. Variable Defined Let’s make one for Diya first! YOU! Diya Kevin Navaneeth Nikita Usra Aadil Pratyush Ayaann S.K. Sowmya Arnav
  • 60. OK! Let make a birthday card for Diya! First... Name Then make the “0” = Diya! (because we want her to be displayed on the birthday card) Step # 1:
  • 61. second... choose the symbolic name for the variable! Name Then choose the symbolic name for me = “name” Step # 2:
  • 62. Now let’s look at the Birthday Card as we have it in the Scratch program! Name Place for Name Place for Name
  • 64. Name 1. Diya’s name shows up in both places 2. ...at the same time 3. ...and you didn’t write anything by hand!!!! WOW! YOU!
  • 65. HOW? YOU! Show & Tell: Birthday Card Sprite No code required! It just site in the background looking great!
  • 66. HOW? YOU! Show & Tell: Balloon Sprite Code translation: The “Name” variable, set to “Diya” is going to show for “7” seconds
  • 67. HOW? YOU! Show & Tell: Party Hat Sprite Code translation: The “Name” variable, set to “Diya” is going to show for “7” seconds
  • 68. Wait! You are using the same code for the balloon AND the party hat? YOU! Show & Tell: Tale of 2 Sprites Code translation: The “Name” variable, set to “Diya” is going to show for “7” seconds
  • 69. Show & Tell: Tale of 2 Sprites Code translation: The “Name” variable, set to “Diya” is going to show for “7” seconds YES! That is the superpower of a variable! Name
  • 70. End of the Story! Now I know how to make a birthday card for each one of my friends! YOU! Excellent! Glad I could help! Call on me anytime! My superpowers are always available! Name
  • 71. Now let’s go back and apply our knowledge about variables to adding a score to the HareGame! My superpowers are always available! Name
  • 72. Let’s review: There were 4 steps to making this game... 1 2 3 4 Make the hare jump Make the game obstacle Make the strawberry for the hare to eat! Make the hare move STEP 1 STEP 3 STEP 2 STEP 4
  • 73. Let’s review: Step #1 & #2 are not related to scoring; they deal with costume details. On the other hand, the ball and strawberry cause things happen to in the game. Let’s look closer….. 3 4 Make the game obstacle Make the strawberry for the hare to eat! STEP 3 STEP 4
  • 74. Objective of Strawberry How is the strawberry an advantage in the game? If the hare touches the strawberry the game continues. The strawberry = ONE point. Objective of Ball How is the ball a challenge in the game? If the hare touches the ball the game will stop. The ball = ZERO points. Objective of The Hare The hare is the trigger (conditional) for when the score increases or stops the game. What is the hare’s role in the game?
  • 76. Objective of Strawberry How is the strawberry an advantage in the game? If the hare touches the strawberry the game continues. The strawberry = ONE point. Objective of Ball How is the ball a challenge in the game? If the hare touches the ball the game will stop. The ball = ZERO points. Objective of The Hare The hare is the trigger (conditional) for when the score increases or stops the game. What is the hare’s role in the game? ● Now that we have reviewed the details of the game let’s get ready to start coding our score! ● Does the hare Sprite need a coding variable? ○ NO! Because it is the trigger (conditional) of the action ○ We need to code the score where counting happens! ■ Ball = 0, stops game ■ Strawberry = +1 to score
  • 77. Objective of Strawberry How is the strawberry an advantage in the game? If the hare touches the strawberry the game continues. The strawberry = ONE point. Objective of Ball How is the ball a challenge in the game? If the hare touches the ball the game will stop. The ball = ZERO points. Objective of The Hare The hare is the trigger (conditional) for when the score increases or stops the game. What is the hare’s role in the game? ● Let’s make the game better by telling the player what is going on when the hare touches the ball. ● Solution: make a “GAME OVER” backdrop if/when the hare touches the ball ● When you play the game it stops if/when the hare touches the ball ● No additional coding required to “not” add points to the game Review Code
  • 78. Let’s make the game more “user-friendly” and let players know when the game is over! To do that we’re going to create a “GameOver” backdrop Click on the Stage and then Backdrops 1 2 1 2
  • 79. Next we can make a copy of the “BlueSky” backdrop and use it, with modifications, for our “GameOver” backdrop To do this, we 1. right-click on the backdrop and 2. click on the “duplicate” button
  • 80. Now, let’s rename the file to “GameOver,” so we know which backdrop it is when we code. TIP: ● Always name coding elements based on what makes them unique! ● This habit allows you to remember what the element looks like when you choose them name on a coding menu!
  • 81. With our backdrop costume named we can begin to modify the backdrop to “talk” to the player of the game. ● Clicking the “T” (for Text) on the tools menu ● Type “Game Over!”
  • 82. Have fun looking at different text colors!
  • 83. We can change the text font type and/or the size of the font! So many options!
  • 84. Let’s write a second line of text telling the player how to reset the game! Challenge! Choose a different font for the second text
  • 85. Hummm...where should we code the “GameOver” backdrop? The hare, the ball, or the strawberry? The ball! Why? The Ball Sprite has the code that causes the game to STOP!
  • 86. When do we want our “GameOver” backdrop to show? ● Before the game stops! ● So we’ll need to place the “switch backdrop to()” block + “GameOver backdrop in the code before everything stops ( )
  • 87.
  • 88. Oh No! The game is still running while the “GameOver” backdrop is up! Correct Incorrect beginning backdrop beginning backdrop
  • 89. How do we fix that? We need the game to start on the BlueSky backdrop - so let’s code that in! *NOTE: Place the backdrop just after the “when green flag clicked” block so the backdrop always appears in the start of the game
  • 90.
  • 91. Great problem solving! The appropriate backdrops are displayed at the correct time - the code works! Start of the game backdrop Correct End of the game backdrop Correct
  • 92. Objective of Strawberry How is the strawberry an advantage in the game? If the hare touches the strawberry the game continues. The strawberry = ONE point. Objective of Ball How is the ball a challenge in the game? If the hare touches the ball the game will stop. The ball = ZERO points. Objective of The Hare The hare is the trigger (conditional) for when the score increases or stops the game. What is the hare’s role in the game? ● When the hare touches (eats) the strawberry it earns a point! ● We need create code that adds points to the score (+1) when the hare touches the strawberry Score: 0 Score: +1
  • 93. Let’s use the 3-step process we just learned create the variable that will allow the strawberry to add 1 point when touched by the hare. Make sure you are on the strawberry’s workspace!
  • 94. How to make a variable…. Step # 1: Go to the variable menu... And click on Make a Variable
  • 95. Step # 1: 1) Go to variable menu 2) Click on “Make a Variable
  • 96. So the way you turn on my superpowers is as follows: Score Step # 2: 1. Choose a “symbolic name” 2. Leave the variable marked “For all sprites” 3. Click on “OK” 1 2 3 1. 2. 3. Score
  • 97. Step # 2: 1) Choose a “symbolic name” 2) Leave the variable marked “For all Sprites” 3) Click on “OK” “For all sprites:” This is the default choice. All Sprites can see and use this variable. “For this sprite only:” Variable can only be used by 1 sprite. The restriction is labeled.
  • 98. TIP! *Make a mistake with a variable? *Want to rename of delete????? Right click on the variable itself When you are selecting a variable
  • 99. Score Step # 3: ● you can see my “symbolic name” on the taskbar I can use my superpowers for you when…... Variables
  • 100. WARNING! Make sure you know if you want the variable to show or no-show! Your choice!
  • 101. Your screen should look like this
  • 102. The hare earns a point every time it touches (eats) a strawberry! Score The game is set to start at zero. Once the hare touches a strawberry we need to increase our variable “score” by 1 Step # 1: Go to the variable toolbar and get the “change my variable by () block
  • 103. second... choose the symbolic name for the variable! Name Change the symbolic name of the variable to “score” Step # 2:
  • 104.
  • 105. Now you should see your score add by 1! The game is complete!? YES!!!!!!
  • 106. Score
  • 107.
  • 108. Objective of the Balloon Popping Game 1. The game is to touch the moving balloon. 2. Each balloon = ONE point (+1) is added to the score.
  • 110. Project #2: File Naming Protocol BalloonPopping(Your first name) ● Example: BalloonPoppingAbia
  • 111. BalloonPoppingNardos Name the project “BalloonPopping(Name)”
  • 112. Delete the sprite we won’t be using...
  • 113. ...and get the balloon sprite so we can pop it in our game! Click on “choose a sprite”
  • 114. Your screen should look like this
  • 115. Use the search bar to search for a balloon! Now, we are ready for coding!
  • 116. Have you heard of video sensing?
  • 117.
  • 119. Video sensing definition ● Video sensing is computer software that tracks motion (and sometimes color) through video ○ The computer looks at the images in a video frame by frame! ● Allows the computer to perform actions on virtual objects based on YOUR movement! ○ Just like the filters that move on apps like Snapchat, Instagram and more
  • 120. Hmmm...I wonder if there’s a way to play with video sensing in Scratch?
  • 121. There’s a way to do it! Scratch has many extensions that allow you to expand your skills
  • 122. Let’s use Video Sensing blocks in Scratch! Video Sensing
  • 123. To start, click on the extensions button in the bottom left corner Click on the extension“Video Sensing” Steps access video sensing 1 2
  • 124. Now we got 4 video sensing blocks
  • 125. Let’s turn our video on!
  • 126. OH NO! Nothing happens and we still don’t see our video
  • 127. In order to use your camera, Scratch needs permission to access it. 1. Click on the camera icon with an on the website URL tab 2. The tells us that camera is blocked 3. This icon allows you to grant the website permission to use your video
  • 128. Select the “always allow” option and click done Scratch CAN’T access camera Scratch CAN access camera https://support.microsoft.com/en-us/windows/turn-on-app-permissions-for-your-camera-in-windows-10-87ebc757-1f87-7bbf-84b5-0686afb6ca6b Permission to use camera-Microsoft
  • 129. WAIT!! Notice this message ● The camera might not immediately work ● To fix this, reload the page “This page may need to be reloaded before the new settings take effect.”
  • 130. Hmmm..we still can’t see the camera, let’s play with the video sensing blocks one by one and see what happens...
  • 131.
  • 132. Grr...We still don’t see anything!!!! I wonder if something will happen when I move around...
  • 134. ● When the amount of movement a person makes is greater than the selected number…. ○ The code that follows will run ● Goes from 0 to 100 ○ 0: Don’t need much movement ○ 100: Needs a lot of movement
  • 135. Let’s look at what else we can do with the video. The drop down menu shows us options, I’m going to try selecting “off”
  • 136.
  • 137. ● We use the green flag because we’ve always started our code with before ● The green flag “activates” or runs our code ● But our code for this activity does not have this block… So How do we test our code? In the past we have been testing code using the green flag...
  • 138. ● Our code starts with the dd block ● So now our code is activated and runs when the computer detects our movements! Tip: test your code by moving around!
  • 139.
  • 140. The video is gone! The code is working
  • 141. What happens when we turn video “on flipped”?
  • 142.
  • 143. Let’s compare what we are seeing! Our video is now flipped
  • 145. I’m going to choose to leave the turn video block on
  • 146. Hmm..this block is different. We can’t just add it to our code because it’s round
  • 147. Tip: We can use round blocks in the round editable areas of other blocks Example:
  • 148. What does this code do?
  • 149.
  • 150. The balloon moves away everytime you touch it! BEFORE we run our code AFTER we run our code
  • 151. What if we change it to stage?
  • 152. The balloon still moves away! BEFORE we run our code AFTER we run our code
  • 153. ● Allows the computer to perform actions on a sprite or stage based on YOUR movement! ● Needs to be added to another block in order to work
  • 154. I’m going to get rid of that code and move the ballon closer to the middle of the stage because I want the balloon back for the game
  • 155. Let’s see what the last video sensing block does..
  • 156.
  • 157. I can’t see any changes... Let’s try changing the number..
  • 158.
  • 159. Look at the difference!
  • 160. I like the way it was before so I’m going to keep the transparency at 50. You can do whatever you like! This is something to personalize to your tastes and the capabilities of your computer!
  • 161. WOOHOO, that was FUN!! Now you know how video sensing works in Scratch!
  • 162. Objective of the Balloon Popping Game 1. The game is to touch the moving balloon. 2. Each balloon = ONE point (+1) is added to the score.
  • 163. 1. The game is to touch the moving balloon. ● The balloon isn’t moving yet ● How can we move the ballon? ○ What if we have it go to random places on stage
  • 164. How can we move the ballon? We can use this block! ● Moves our sprite to random places on the stage ● You (as the programmer) can’t predict where the sprite will be next
  • 165. Under the “motions” tab, drag the “go to random position” block to your code
  • 166.
  • 167. LOOK! The balloon is all around the stage
  • 168. Objective of the Balloon Popping Game 1. The game is to touch the moving balloon. 2. Each balloon = ONE point (+1) is added to the score.
  • 169. 2. Each balloon = ONE point (+1) is added to the score ● We need to keep track of points ● How can we store and keep track of values? 1 1 1 1 1 1 1 1 1
  • 170. To do this, we need to create a variable! ● Purpose: store the value of how many points the player scores ● Identifier: “score” score How can I use my superpowers for you?
  • 171. Step # 1: 1) Go to variable menu 2) Click on “Make a Variable
  • 172. Step # 2: Score 1. Choose a “symbolic name” 2. Leave the variable marked “For all sprites” 3. Click on “OK” 1. 2. 3. 2 3
  • 173. Now the variable shows up! Make sure the blue check next to the score variable is clicked
  • 174. Objective of the balloon When we “pop” the balloon, we get one point!!! What is the balloon’s role in the game?
  • 176.
  • 177. Our score isn’t changing!
  • 178. REMINDER: Use the drop down on the change block and select the “symbolic name” which in this case is “score”
  • 179.
  • 181. Hmm… wouldn’t it be nice to have popping sounds to the balloon… Let’s add sound This block will play the pop sound *Everytime motion is detected on the balloon, it will make a “Pop” sound like bubblegum!
  • 182. Now we can hear the balloon pop before it gets to new location on the stage!! Add the “play sound until done” block and move around to see if it works...
  • 183. WAIT!!! ● The scores keeps going up and up! ● What if I wanted to play with my friend? ○ Hmm..I don’t want my friend to continue using my own score ○ At what point will can the player restart the score from 0 Change “my variable” to “score”
  • 184.
  • 185. OH NO! Now the score is always 0! Let’s try setting the score to 0 when the green flag is clicked
  • 186.
  • 187. YEAH! It works now, but it’s a little fast and I wonder if the game can run smoother... I remember seeing Ms.D’s code and I liked that her score went increased slower. Let’s try what she did
  • 188. Even though we are not remixing the project, we are ethical coders so we have to give Ms.D credit! Thanks to Ms.D for her help!
  • 189. It is like the If statement is the cause, the then statement is the effect If: It was raining Then: I used an umbrella ● “If - then” bocks tell the computer to perform an action when a condition is true ● The score goes up only when the computer detects movement greater than 5 on the sprite (condition)
  • 190. Drag the “if then” block to your code
  • 191. To add the > sign, let’s go under “operators” and drag the block with the pointy edges that will fit in the condition of the “if-then” block
  • 192. Now we can add the video sensing block we need to the condition
  • 193.
  • 194. The game works much better! Let’s change it up and have the balloon change colors
  • 195. ● I want to dance and play with music! ● Let’s add some background music by going to the “sounds” tab FUN!!! The color changes and I have a brilliant idea...
  • 197. Look at all the sound clip options!
  • 198. I’m going to try out the sounds under “loops” I like “Dance Sitar”, you can pick whichever one you like
  • 199. Play the sound and test the game ● I think the music is too loud so I want it to be a little quieter ○ Use the “softer” button to do this
  • 200. Under the code tab, add “another green flag clicked” block the “play sound until done” block
  • 201. OH NO! I want to keep playing but the music stopped ● We want the music to keep playing until we leave the game ● Let’s use a forever block which will repeat the action again and again and again!
  • 202.
  • 203. YEAHH! Our game is completed!
  • 204. Save and share your project, then put it in this week’s studio Don’t forget to give Ms.D credit
  • 205.
  • 208. Coolest Projects Competition https://online.coolest projects.org/ Registration is OPEN! You can register to share your creations in Raspberry Pi's world-leading online tech showcase! Raspberry Pi welcomes projects from anywhere in the world, whatever your experience level!
  • 209. Check out your class resources! The links are in the YouTube description! Don’t forget to…..
  • 210. ● Never miss an episode! ● Get Notified of new shows! CodeTigers SUBSCRIBE
  • 211. Scratch Lesson 6: Creative Coding! (FUN-ctions!) Join us next week for…..