Soccer Scoring Game

Document created by on Jun 19, 2019Last modified by on Jun 21, 2019
Version 7Show Document
  • View in full screen mode

Screen capture of how to play video sensing coding game on Scratch



By: Lisa Anne Floyd


As the school year draws to a close for many of us, I thought I’d share a coding activity that you might try with your students in the last few days. Inspired by the FIFA Women’s World Cup, I’ve shared a series of video tutorials to assist you or your students with making a Soccer Scoring Application that uses the Video Sensing blocks to move the ball around the screen. Perhaps some students might remix it afterward to create a basketball game, since we all still seem to have Raptors Fever!


While the video tutorials will help students to create a specific game, by following along, they will gain some new skills that can be applied to other future applications. Perhaps students will remix this program and add their own creative ideas or extensions. I’ve shared some ideas at the end to help with inspiration. The goal (besides getting the ball in the net) is to support students with learning about coding blocks in Scratch 3.0 - but it’s also important that they have the opportunity to apply this new knowledge afterward. By sharing this activity during the last week of school, maybe your students will be inspired to get their coding on all summer!


I’ve outlined the suggested order of tutorials below, as well as shared some screen prints of code for those who don’t require the explanations in the video.

Here’s what the final application looks like – you may wish to check it out yourself and play the game by moving the ball with your hand using the video motion. I would not share this link with students if you plan on having them follow the tutorials to code it themselves.


The application will only work on computers with webcams (e.g., laptops, Chromebooks).


Computer Science Concepts:

  • Variables
  • Decision Structures
  • Loops
  • Accumulators (score)
  • Sensors – Video Sensing
  • Coordinate Grid


Here is a link to a PDF that you might want to print or share with students in your online classroom.


Game Description:


Click the green flag to begin. Move the soccer ball with your hand using the video sensor, to the net to score a goal. How many goals can you score in 45 seconds? 


Move the ball using video motion to the net you have 45 seconds


Tutorials – Five Part Series


*This activity has been scaffolded, so students can complete one or all five tutorials and the game is still fun to play.


Here’s a template with two sprites ready to go.


It is suggested that you go to this link and Remix to begin creating this application.


Part 1 – Moving the soccerBall sprite around the screen with your hand


You will need to add extension blocks by clicking on this icon icon at the bottom left of the screen.  Select the Video Sensing sensing icon


Here’s an image of the code you will need to add to your soccerBall sprite so that ball will move around the screen with the motion detected by the video.


soccerSprit code


This video walks you through how to add these blocks to your application and will also explain what some of these blocks mean.


Video Tutorial link



Part 2 – Saying to the user that they scored a goal when the ball touches the net and resetting the soccerBall


Here’s an image of the code you will add to your previous code so that when the soccerBall is touching the net, it will say “Goal!” and your soccerBall will go back to the beginning location.


part two of the code



This video walks you through how to add these blocks to your application and will also explain what some of these blocks mean.


Video Tutorial link



Part 3 – Keeping track of the score


part three of the code

Video Tutorial link



Part 4 – Adding a timer to set the GameTime Allotted


part four of the code



Video Tutorial link



Part 5 – Adding instructions for the user and indicating the score at the end


Complete application:


part five of the code


Video Tutorial link




Suggested Extensions:

  1. Can you remix the game to create a basketball scoring application?
  2. Can you add sound effects to your application?
  3. Can you create an application that has multiple levels?
  4. Can you think of another use for Video Sensing?
  5. Can you create a more accessible application? Hint: Use Text to Speech Blocks or Record your voice.
  6. Can you create an application with moving sprites – and then use the video sensing blocks to have the user try to touch the moving sprites?


Let us know in the comment thread below how your students remix this application or create a new application with their newly developed skills!