Monday, April 25, 2011

Scratch Soccer Game Part 2

Welcome to Part 2 of our Scratch Soccer Game. Click the top right hand corner green flag to start. (Make sure computer sound is on, so you can hear the sound effects).

Then use the keyboard arrow keys on your computer to move side to side and kick the ball. If you miss a ball and it goes through to the yellow line, then you lose, and the game ends.

Use the top right hand corner red stop sign to stop the animation.
Then Click the Green Flag in the top right corner to Play Again.

This post contains the second of a series of tutorials that will result in our final full soccer game.

In this second tutorial we add a Goal Net to our game.

The Soccer Player and ball were obtained for free from We modified the player in Adobe Fireworks and resized him to around 50x50 pixels in size, then saved him as a transparent GIF file. (When doing this, we had to go into "options" while saving and turn alpha transparency on in Fireworks).

Clker Red Soccer Player Sprite

Soccerball Sprite

We obtained the Goals from an American Department store online catalogue, and changed their background from white to green using the colour replace painting tool in Adobe Fireworks.

Soccer Goal Sprite

Because the goals contained some white colour, they caused some false "out of bounds" problems, and so we fixed this by changing the game's out of bounds line from white to yellow by editing the background in Scratch.

The following YouTube tutorial shows the steps required to build Part 2 of the Soccer Game that is present at the start of this post.

Note that by adjusting the bottom right hand controls, it can be viewed full screen in HD. (Press Escape to return to this blog page when finished).

Here is the script code for the "Kicker" that allows the arrow keys to be used to move him left and right along the bottom of the screen.

Pt 2 Kicker Script

Here is the script code for the Goals that allows them to broadcast a message to the ball whenever a Goal is kicked.

Pt 2 Goal Script

Finally, here are all of the script code blocks for the ball.

Pt 2 Ball Script

We will finalise the development of this Soccer Game in upcoming Tutorials.

Our plans are to create scoring for the Goals, as well as creating lost lives for missed kicks, and track these as well. The game will also issue a "Game Over" message when all lives have been lost.

Keep an eye out for these tutorials in upcoming posts.

Make sure you give our tutorials a go, by downloading and installing the Scratch Development Environment for free on your PC from the following link:

We promise you will really enjoy kicking goals with Scratch!

Big Passy Wasabi

No comments:

Post a Comment