Scratch Game
Advanced
60 mins
180 points
What you need:

Penalty Shootout

Create a penalty shootout game, can you score on the keeper?

1 - Create a new Scratch project

Go to the Scratch website and create a new Scratch project. You can delete the cat sprite.

2 - Download and add the goal backdrop

Included with this step is a picture of a soccer goal, download this picture onto your computer and then upload it as a new backdrop in your project.


If for some reason you can't save the background image to your computer and upload it, you can just use this starter project which already has the backdrop added to it. https://scratch.mit.edu/projects/573459765/editor/

3 - Add the Soccer Ball sprite

Add the Soccer Ball sprite from the sprite library and give it the following code to set it up for the start of the game.

when green flag clicked set size to (100) % go to x (0) y (-130) // the bottom middle of the stage area



4 - Choose your shot

To take a penalty shot you will click with your mouse the spot in the goal where you want to ball to go. This means that you will be clicking the backdrop so add the following code to the backdrop to broadcast a message.

when stage clicked broadcast [shoot v]


5 - Move the ball

Now let's make the ball move to the spot that you clicked.

When the ball receives the 'shoot' message. we will make the ball move towards where your mouse pointer is and also shrink the ball so that it looks like it's moving away from you.

Add the following code to the Soccer Ball sprite.

when I receive [shoot v] point towards [mouse-pointer v] repeat (30) change size by (-2) move (8) steps end


Join our club 😃

To view the remaining 5 steps and access hundreds of other coding projects please login or create an account.

Copyright Notice
This lesson is copyright of 123code. Unauthorised use, copying or distribution is not allowed.

Scratch is developed by the Lifelong Kindergarten Group at the MIT Media Lab. It is available for free at https://scratch.mit.edu
🍪 Our website uses cookies to make your browsing experience better. By using our website you agree to our use of cookies. Learn more