SlideShare a Scribd company logo

Class #4: Starting from Scratch: Games

Starting With Scratch is a block-based programming course provided by the CodeTigers and STEM Impressionists Program collaboration. Over the course of 10 weeks, students will practice programming on Scratch while simultaneously learning fundamental computer science concepts. Each week will be taught by two student mentors who will walk participants through different lessons that will overtime build their understanding of coding through the Scratch platform. Throughout the course, students will be provided with resources to further their exploration of computer science in addition to preparing them to continue on to other coding platforms such as Python, micro:bit, and HTML/CSS. YouTube class: https://www.youtube.com/watch?

1 of 200
Download to read offline
Class #4: Starting from Scratch: Games
Coolest Projects Competition
https://online.coolest
projects.org/
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!
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!
Coolest Projects Competition
In 2020, coding superstar Bhakti (13) from Prune, India, entered Coolest Projects. She
submitted her Scratch game “Save Animals.”
https://online.coolestprojects.org/projects/373
Reminder
Please be respectful and
appropriate with your
responses in the chat!

Recommended

ISTE Presentation Resource List
ISTE Presentation Resource ListISTE Presentation Resource List
ISTE Presentation Resource ListAngela DeHart
 
AldiEliminatingPlasticBage2023.pdf
AldiEliminatingPlasticBage2023.pdfAldiEliminatingPlasticBage2023.pdf
AldiEliminatingPlasticBage2023.pdfAngela DeHart
 
IbelongInCSsample.pdf
IbelongInCSsample.pdfIbelongInCSsample.pdf
IbelongInCSsample.pdfAngela DeHart
 
CSTA Teacher Standards (2021)
CSTA Teacher Standards (2021)CSTA Teacher Standards (2021)
CSTA Teacher Standards (2021)Angela DeHart
 
Starting early: Developing 21st Century Skills for Your Next Step in STEM: Co...
Starting early: Developing 21st Century Skills for Your Next Step in STEM: Co...Starting early: Developing 21st Century Skills for Your Next Step in STEM: Co...
Starting early: Developing 21st Century Skills for Your Next Step in STEM: Co...Angela DeHart
 
HackSIP2: The Extended Class Poster
HackSIP2: The Extended Class PosterHackSIP2: The Extended Class Poster
HackSIP2: The Extended Class PosterAngela DeHart
 
HackSIP2: The Extended Class
HackSIP2: The Extended ClassHackSIP2: The Extended Class
HackSIP2: The Extended ClassAngela DeHart
 

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

Overview of Databases and Data Modelling-1.pdf
Overview of Databases and Data Modelling-1.pdfOverview of Databases and Data Modelling-1.pdf
Overview of Databases and Data Modelling-1.pdfChristalin Nelson
 
The Ministry of Utmost Happiness by Arundhati Roy
The Ministry of Utmost Happiness by Arundhati RoyThe Ministry of Utmost Happiness by Arundhati Roy
The Ministry of Utmost Happiness by Arundhati RoyTrushali Dodiya
 
LIPIDS UNIT ONE BIOMOLECULE PRESENTATION
LIPIDS UNIT ONE BIOMOLECULE PRESENTATIONLIPIDS UNIT ONE BIOMOLECULE PRESENTATION
LIPIDS UNIT ONE BIOMOLECULE PRESENTATIONSayali Powar
 
Exit Essay - Save the Filipino Language by Renz Perez.docx
Exit Essay - Save the Filipino Language by Renz Perez.docxExit Essay - Save the Filipino Language by Renz Perez.docx
Exit Essay - Save the Filipino Language by Renz Perez.docxMYDA ANGELICA SUAN
 
ACTIVIDAD DE CLASE No 1 sopa de letras.docx
ACTIVIDAD DE CLASE No 1 sopa de letras.docxACTIVIDAD DE CLASE No 1 sopa de letras.docx
ACTIVIDAD DE CLASE No 1 sopa de letras.docxMaria Lucia Céspedes
 
UniSC Sunshine Coast library self-guided tour
UniSC Sunshine Coast library self-guided tourUniSC Sunshine Coast library self-guided tour
UniSC Sunshine Coast library self-guided tourUSC_Library
 
Evaluation and management of patients with Dyspepsia.pptx
Evaluation and management of patients with Dyspepsia.pptxEvaluation and management of patients with Dyspepsia.pptx
Evaluation and management of patients with Dyspepsia.pptxgarvitnanecha
 
Unleashing the Power of AI Tools for Enhancing Research, International FDP on...
Unleashing the Power of AI Tools for Enhancing Research, International FDP on...Unleashing the Power of AI Tools for Enhancing Research, International FDP on...
Unleashing the Power of AI Tools for Enhancing Research, International FDP on...Dr. Vinod Kumar Kanvaria
 
Grades 7 to 8 Anti- OSAEC and CSAEM session.pptx
Grades 7 to 8 Anti- OSAEC and CSAEM session.pptxGrades 7 to 8 Anti- OSAEC and CSAEM session.pptx
Grades 7 to 8 Anti- OSAEC and CSAEM session.pptxGladysValencia13
 
Website Fixer-Upper Series to Boost your Online Presence
Website Fixer-Upper Series to Boost your Online PresenceWebsite Fixer-Upper Series to Boost your Online Presence
Website Fixer-Upper Series to Boost your Online PresenceSamantha Russell
 
mean stack mean stack mean stack mean stack
mean stack mean stack  mean stack  mean stackmean stack mean stack  mean stack  mean stack
mean stack mean stack mean stack mean stackNuttavutThongjor1
 
Bayesian Analysis Fundamentals with Examples
Bayesian Analysis Fundamentals with ExamplesBayesian Analysis Fundamentals with Examples
Bayesian Analysis Fundamentals with ExamplesTushar Tank
 
Chromatography-Gas chromatography-Principle
Chromatography-Gas chromatography-PrincipleChromatography-Gas chromatography-Principle
Chromatography-Gas chromatography-Principleblessipriyanka
 
Writing Agony Letter & If type O+1 & Diphthongs + Text “Arab Science”.pdf
Writing Agony Letter & If type O+1 & Diphthongs + Text “Arab Science”.pdfWriting Agony Letter & If type O+1 & Diphthongs + Text “Arab Science”.pdf
Writing Agony Letter & If type O+1 & Diphthongs + Text “Arab Science”.pdfMr Bounab Samir
 
Diploma 2nd yr PHARMACOLOGY chapter 5 part 1.pdf
Diploma 2nd yr PHARMACOLOGY chapter 5 part 1.pdfDiploma 2nd yr PHARMACOLOGY chapter 5 part 1.pdf
Diploma 2nd yr PHARMACOLOGY chapter 5 part 1.pdfSUMIT TIWARI
 
Data Modeling - Entity Relationship Diagrams-1.pdf
Data Modeling - Entity Relationship Diagrams-1.pdfData Modeling - Entity Relationship Diagrams-1.pdf
Data Modeling - Entity Relationship Diagrams-1.pdfChristalin Nelson
 
catch-up-friday-ARALING PNLIPUNAN SOCIAL JUSTICE AND HUMAN RIGHTS
catch-up-friday-ARALING PNLIPUNAN SOCIAL JUSTICE AND HUMAN RIGHTScatch-up-friday-ARALING PNLIPUNAN SOCIAL JUSTICE AND HUMAN RIGHTS
catch-up-friday-ARALING PNLIPUNAN SOCIAL JUSTICE AND HUMAN RIGHTSCarlaNicolas7
 

Recently uploaded (20)

Overview of Databases and Data Modelling-1.pdf
Overview of Databases and Data Modelling-1.pdfOverview of Databases and Data Modelling-1.pdf
Overview of Databases and Data Modelling-1.pdf
 
The Ministry of Utmost Happiness by Arundhati Roy
The Ministry of Utmost Happiness by Arundhati RoyThe Ministry of Utmost Happiness by Arundhati Roy
The Ministry of Utmost Happiness by Arundhati Roy
 
Lipids as Biopolymer
Lipids as Biopolymer Lipids as Biopolymer
Lipids as Biopolymer
 
LIPIDS UNIT ONE BIOMOLECULE PRESENTATION
LIPIDS UNIT ONE BIOMOLECULE PRESENTATIONLIPIDS UNIT ONE BIOMOLECULE PRESENTATION
LIPIDS UNIT ONE BIOMOLECULE PRESENTATION
 
Exit Essay - Save the Filipino Language by Renz Perez.docx
Exit Essay - Save the Filipino Language by Renz Perez.docxExit Essay - Save the Filipino Language by Renz Perez.docx
Exit Essay - Save the Filipino Language by Renz Perez.docx
 
ACTIVIDAD DE CLASE No 1 sopa de letras.docx
ACTIVIDAD DE CLASE No 1 sopa de letras.docxACTIVIDAD DE CLASE No 1 sopa de letras.docx
ACTIVIDAD DE CLASE No 1 sopa de letras.docx
 
UniSC Sunshine Coast library self-guided tour
UniSC Sunshine Coast library self-guided tourUniSC Sunshine Coast library self-guided tour
UniSC Sunshine Coast library self-guided tour
 
Evaluation and management of patients with Dyspepsia.pptx
Evaluation and management of patients with Dyspepsia.pptxEvaluation and management of patients with Dyspepsia.pptx
Evaluation and management of patients with Dyspepsia.pptx
 
Unleashing the Power of AI Tools for Enhancing Research, International FDP on...
Unleashing the Power of AI Tools for Enhancing Research, International FDP on...Unleashing the Power of AI Tools for Enhancing Research, International FDP on...
Unleashing the Power of AI Tools for Enhancing Research, International FDP on...
 
Grades 7 to 8 Anti- OSAEC and CSAEM session.pptx
Grades 7 to 8 Anti- OSAEC and CSAEM session.pptxGrades 7 to 8 Anti- OSAEC and CSAEM session.pptx
Grades 7 to 8 Anti- OSAEC and CSAEM session.pptx
 
Website Fixer-Upper Series to Boost your Online Presence
Website Fixer-Upper Series to Boost your Online PresenceWebsite Fixer-Upper Series to Boost your Online Presence
Website Fixer-Upper Series to Boost your Online Presence
 
Time-Honored Wisdom: African Teachings for VUCA Leaders
Time-Honored Wisdom: African Teachings for VUCA LeadersTime-Honored Wisdom: African Teachings for VUCA Leaders
Time-Honored Wisdom: African Teachings for VUCA Leaders
 
Capter 5 Climate of Ethiopia and the Horn GeES 1011.pdf
Capter 5 Climate of Ethiopia and the Horn GeES 1011.pdfCapter 5 Climate of Ethiopia and the Horn GeES 1011.pdf
Capter 5 Climate of Ethiopia and the Horn GeES 1011.pdf
 
mean stack mean stack mean stack mean stack
mean stack mean stack  mean stack  mean stackmean stack mean stack  mean stack  mean stack
mean stack mean stack mean stack mean stack
 
Bayesian Analysis Fundamentals with Examples
Bayesian Analysis Fundamentals with ExamplesBayesian Analysis Fundamentals with Examples
Bayesian Analysis Fundamentals with Examples
 
Chromatography-Gas chromatography-Principle
Chromatography-Gas chromatography-PrincipleChromatography-Gas chromatography-Principle
Chromatography-Gas chromatography-Principle
 
Writing Agony Letter & If type O+1 & Diphthongs + Text “Arab Science”.pdf
Writing Agony Letter & If type O+1 & Diphthongs + Text “Arab Science”.pdfWriting Agony Letter & If type O+1 & Diphthongs + Text “Arab Science”.pdf
Writing Agony Letter & If type O+1 & Diphthongs + Text “Arab Science”.pdf
 
Diploma 2nd yr PHARMACOLOGY chapter 5 part 1.pdf
Diploma 2nd yr PHARMACOLOGY chapter 5 part 1.pdfDiploma 2nd yr PHARMACOLOGY chapter 5 part 1.pdf
Diploma 2nd yr PHARMACOLOGY chapter 5 part 1.pdf
 
Data Modeling - Entity Relationship Diagrams-1.pdf
Data Modeling - Entity Relationship Diagrams-1.pdfData Modeling - Entity Relationship Diagrams-1.pdf
Data Modeling - Entity Relationship Diagrams-1.pdf
 
catch-up-friday-ARALING PNLIPUNAN SOCIAL JUSTICE AND HUMAN RIGHTS
catch-up-friday-ARALING PNLIPUNAN SOCIAL JUSTICE AND HUMAN RIGHTScatch-up-friday-ARALING PNLIPUNAN SOCIAL JUSTICE AND HUMAN RIGHTS
catch-up-friday-ARALING PNLIPUNAN SOCIAL JUSTICE AND HUMAN RIGHTS
 

Class #4: Starting from Scratch: Games

  • 3. 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!
  • 4. 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!
  • 5. Coolest Projects Competition In 2020, coding superstar Bhakti (13) from Prune, India, entered Coolest Projects. She submitted her Scratch game “Save Animals.” https://online.coolestprojects.org/projects/373
  • 6. Reminder Please be respectful and appropriate with your responses in the chat!
  • 9. ● Never miss an episode! ● Get Notified of new shows! CodeTigers SUBSCRIBE
  • 10. 1. Introductions 2. Project Showcase 3. Scratch Project 4. Mentimeter
  • 11. What you will learn 1. Creating a game 2. Coordinate Placement on Scratch
  • 12. Meet the Mentors! Starting with Scratch:
  • 14. Virginia, USA 10th grade Photography & Design
  • 15. Virgina, USA 12th grade Playing Lacrosse & Drawing
  • 18. 1. Unique2006573 2. Coding2705 3. Scratch_Ruk 4. MistressBrain 5. ShriDev 6. ShauryaKhunger 7. dimondowl Excellent job!
  • 21. But first... Shoutout to Zoe from the Scratch Team! Today’s project is inspired by the: Jumping Chick Game
  • 22. We will be making the Jumping Hare Game:
  • 23. Hare vs Rabbit What is the difference? Long ears Long body Powerful hind legs Short legs Short ears Hare Rabbit Small body
  • 25. There are 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
  • 26. Step 1: Make the hare jump 1
  • 27. Step 2: Have the hare change costumes Costume 1 Costume 2 Costume 3 2
  • 28. Step 3: Add a ball sprite to be the obstacle 3
  • 29. Step 4: Add a strawberry sprite for the hare to eat 4
  • 30. Look for these flags at the top right corner of the screen to see which step we are on! 3 4 2 1
  • 31. Project #1 File Naming Protocol HareGame(Your first name) ● Example: HareGameAya
  • 34. Create a new project
  • 35. Name the project “HareGame(Name)” HareGameMera
  • 37. Let’s start by setting up the stage From this... ...to this
  • 38. From this... ...to this We need to: ● Delete the cat sprite ● Add the “Blue Sky” backdrop ● Delete the white backdrop ● Add the “hare” sprite
  • 39. Delete the sprite we won’t be using
  • 40. Let’s pick a backdrop
  • 41. Your screen will look like this
  • 42. Search for the “Blue Sky” backdrop
  • 43. Let’s see what’s in the backdrops tab
  • 44. Looks like we have two backdrops! We only need the “blue sky” backdrop though
  • 45. We don’t need it so delete the white backdrop.
  • 46. Now let’s head back to the code tab
  • 47. Time to pick a new sprite
  • 48. Search for a hare
  • 49. Let’s go to to the costumes tab
  • 50. This is where the hare’s costumes are located Costume 1 Costume 2 Costume 3
  • 51. We’re going to rename the costumes to match the action of the hare
  • 52. In costume 1, the hare is sitting SittingHare
  • 53. In costume 2, the hare is jumping JumpingHare
  • 54. In costume 3, the hare is landing LandingHare
  • 55. We’re going to rename the costumes
  • 56. Let’s go back to the code tab and begin using the blocks
  • 57. We want the hare to stay in this position throughout the game
  • 58. Did you know that there is a coordinate plane behind what we see when we are talking to a computer? That is how the computer “knows” where to put the objects we move about the stage when we code!
  • 59. This is a motion block that allows you to set the sprite to a specific location on the stage
  • 60. Under the motions tab, this block will default to the coordinate that your sprite is on Right now the sprite is on this coordinate:
  • 61. But the blue motion block won’t work by itself! We’ll need the “when flag clicked” block to help activate the code The code on your workspace will look like this
  • 62. Now drag the hare to a random spot on the stage then...
  • 64. Every time you click on the green flag, the hare should be back at the bottom left corner of the stage
  • 66. There are 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
  • 67. Now let’s make the hare jump up and down 1
  • 68. To do that, we’re going to use the “change y by” block This block will move your sprite up or down depending on the value you put in 1
  • 69. When you put in a positive value, the hare will move upwards 1 10
  • 70. 1 10 When you put in a negative value, the hare will move downwards
  • 71. 1 10 This grid is just an example Scratch actually uses much smaller coordinates that we can’t see
  • 72. Drag both the blocks to your workspace 1
  • 73. 1
  • 74. Click on each of the “change y by” blocks This block will move the hare up by 10 This block will move the hare down by 10 1
  • 75. Hmm… we need the hare to move up a bit higher 1
  • 76. To do this, we are going to need a “repeat” block This block will loop other blocks inside of it a certain number of times A loop is a sequence of instructions that is repeated over and over again 1
  • 78. This code will move the hare up by 100 coordinates: 1 100
  • 79. This code will move the hare down by 100 coordinates: 1 100
  • 80. Make sure to have two repeat blocks Connect these two blocks 1
  • 81. 1
  • 82. Now the hare goes up and down with just one click! 1
  • 83. 1 Instead of clicking the blocks to make the hare jump, we can use the space bar instead!
  • 84. To do this, we are going to need a “when space key pressed” block Any code under this block will be activated when the space key is pressed on a keyboard 1
  • 85. Connect this block to the repeat blocks 1
  • 86. 1
  • 87. Now the hare jumps when the space key is pressed! 1
  • 88. There are 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
  • 89. Time to make the hare change costumes Costume 1 Costume 2 Costume 3 2
  • 90. The next costume block changes the costume to the next one in the list. 2 Once the last costume has been shown, it goes back to the first in a continuous loop. This is useful for repeating an action such as walking.
  • 91. Add the “next costume” block under the “go to x/y” block 2
  • 92. 2
  • 93. It changed costumes - one time/cycle 2
  • 94. ? 2 We need the hare to change costumes more than once...
  • 95. Looks like we are going to need a “forever” block This block will loop other blocks inside of it forever 2
  • 96. This is the second loop block! 2 Do you remember what a loop is?
  • 97. A loop is a sequence of instructions that is repeated over and over again 2
  • 98. Add the forever block to your workspace 2
  • 99. 2
  • 100. Uh oh! Looks like the hare is changing costume way so fast you can see the shadow of the other costume! 2
  • 101. Let’s slow it down by adding a “wait () second” block This block will delay any code from performing by the amount of time you have listed 2
  • 102. 2
  • 103. The hare has slowed down!… might be a little too slow though 2
  • 104. The hare is moving too slow so let’s modify the time 2
  • 105. 2
  • 106. Hmm.. better, but still too slow 2
  • 107. It’s almost there… let’s try a different number until we are satisfied! 2
  • 108. 2
  • 109. This seems like a good pace! 2
  • 110. There are 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
  • 111. Step 3: Add a ball sprite to be the obstacle 3 In order to make the ball the obstacle we have to code the answer the following statement: If the hare touches the ball the game will stop.
  • 112. Let’s add a ball to our game. 3
  • 113. Head back to the sprite page 2
  • 114. Type in “ball” to the search bar 3
  • 115. Now that we have 2 sprites, we want to make sure that we are coding in the right workspace 3
  • 116. The ball is too big for the hare to jump over! Let’s change the size of the ball... 3
  • 117. Let’s figure out what size works best for the ball… 90…80…70…? Hmm… test until your happy! We changed the size from 100 to 80 3
  • 118. I’m happy with the size of the ball (I don’t want it too small) so let’s make the hare bigger! 3
  • 119. Make sure you are on the hare coding workspace 3
  • 120. Let’s figure out what size works best for the hare… 110…115...120...? Hmm… test until your happy! 3 We changed our size to 120
  • 121. Now we want the ball to glide from its starting position to the hare 3
  • 122. Let’s start with moving the ball to the bottom right corner of the stage (starting position) 3
  • 123. Pull the “go to x/y” block to identify the coordinate position the ball starts on 3
  • 124. This block won’t work on it’s own… 3 What other block do we need to activate the code?
  • 125. We need the “When flag clicked” block! 3
  • 126. 3
  • 127. Great! Now the ball will always start from the bottom right corner of the stage (starting position) 3
  • 128. Now let’s make the ball move from the starting position to the hare! This allows us to grab the XY coordinates for the ball’s new location. 3
  • 130. Now let’s make the ball move from its starting position to its ending position. The glide to XY block makes Sprites glide/walk from their starting point to a designated coordinate/location 3
  • 131. Right now the ball sprite is on this coordinate: 3
  • 132. Your code will look like this 3 Starting position Ending position
  • 133. 3
  • 134. Now the ball will glide from the starting position (bottom right corner of the stage) to the hare (bottom left) 3 Start End
  • 135. But we need the ball do repeat it journey, over and over again! What do we do???? 3
  • 136. We create a loop! Which loop block could we use to make the ball keep coming? 3
  • 138. 3
  • 139. Now the ball will glide from the start to the end continuously 3 Start End
  • 140. YES! The code works! 3 The ball goes from the start to the hare over and over - forever...
  • 141. But wait! Doesn’t the game stop if the hare touches the ball? STOP! 3
  • 142. Yes! According to our game plan…. 3 If the hare touches the ball the game will stop.
  • 143. To do this, we’ll need to write code that makes the ball stop if the hare touches it 3
  • 144. 1. The “wait until” block makes a planned action wait until something triggers it to happen To do that we will need two blocks: 3 What is the trigger? What does that mean??????
  • 145. We need to identify the condition that triggers the ball to be an obstacle for the hare? 3 Are we using the mouse to trigger the next action in the game? No. Are we using the edge to trigger the next action in the game? No. Are we using the hare to trigger the next action in the game? Yes!
  • 146. Now your code will look like this. But how do we make it work? The forever block does not allow for a new block to be added! 3
  • 147. We need a “when flag click” block! 3
  • 148. 3
  • 149. When we click the green flag, both sets of code are highlighted 3
  • 150. But when the ball hits the hare, the second set of code is no longer highlighted 3
  • 151. The first set of code has a forever loop which is why it stays highlighted while the game runs. Which is exactly what we want it to do. 3
  • 152. The second set of code doesn’t have a loop which is why it no longer stays highlighted after the ball touches the hare. But that only allows the hare to have an obstacle the first run of the ball. After that the hare won’t the hare won’t have an obstacle/game challenge for the rest of the game. 3
  • 153. So we have to add a forever loop! That makes the ball a challenge EVERY time the hare tries to jump it! 3
  • 154. 3
  • 155. Now both sets of code are highlighted- meaning they are running forever but... 3
  • 156. …..according to our game plan…. 3 If the hare touches the ball, the game will STOP.
  • 157. But the hare is touching the ball and the game is not stopping! Soooo...we need to use the “stop all” block to STOP the game (loop/condition)! 3
  • 158. 3
  • 159. 3 OK, both sets of code are working (highlighted)...
  • 160. 3 ...and when the ball hits the hare, the both sets of code are no longer highlight meaning the game has STOPPED!
  • 161. YES! The code works! 3 The game (loop/conditional) STOPS when the hare touches the ball!!!
  • 162. There are 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
  • 163. Let’s add a strawberry sprite for the hare to eat 4
  • 164. Back to the sprite page! 4
  • 165. Type in “strawberry” in the search bar 4
  • 166. The strawberry is almost as tall as the hare! It is way too big! 4 Let’s make the strawberry a little smaller, just like we did the ball.
  • 167. Let’s figure out what size works best for the strawberry… 90…70…50…? Hmm… test until your happy! 4 We changed the size to 50
  • 168. Just like the ball, we want the strawberry to glide from the right side of the stage to the left side…. 4
  • 169. So if you go back to the ball workspace... 4
  • 170. ...we can use the same code for the Strawberry and save ourselves some coding time! 4
  • 171. Let’s put the code in the backpack so that we can move it to the strawberry! 4
  • 172. First, drag the first set of code to the backpack area (We only need the first set of code because the strawberry is not an obstacle) 4
  • 173. Then go to the strawberry sprite workspace.. 4
  • 174. ...and drag the code to the workspace 4
  • 175. Now we can close the backpack bar 4
  • 176. 4
  • 177. Oh no! The ball and strawberry are overlapping! 4
  • 178. Solution: Let’s have the strawberry wait before gliding so that it can come after the ball 4
  • 179. 4
  • 180. Now when we run the code, there is space in between the strawberry and the ball! 4
  • 181. Oh no! The hare keeps landing on the ball when it jumps and stops the game! What do we do? Let’s think of different ideas to solve the problem: 4 1. We could make the ball and the strawberry smaller 2. We could make the hare bigger 3. We could make the hare jump higher 4. We could change the time on the wait block….
  • 182. We have a number of ideas to solve this problem but I am going to make the hare jump higher. 4
  • 183. 4
  • 184. Looks like the hare is able to jump over the ball now! 4
  • 187. There are 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
  • 190. What if we changed the wait time?
  • 191. What if we change the location of the wait block?
  • 192. What if we added a hide and wait block?
  • 195. 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!
  • 196. Coolest Projects Competition In 2020, coding superstar Bhakti (13) from Prune, India, entered Coolest Projects. She submitted her Scratch game “Save Animals.” https://online.coolestprojects.org/projects/373
  • 197. Check out your class resources! Don’t forget to…..
  • 198. ● Never miss an episode! ● Get Notified of new shows! CodeTigers SUBSCRIBE
  • 199. Scratch Lesson 4: Scoring! Join us next week for…..