How to Make a Football Game in Scratch

by A_J_M in Living > Toys & Games

13217 Views, 1 Favorites, 0 Comments

How to Make a Football Game in Scratch

title.jpg
Screenshot 2021-01-09 20:42:59.png

Have a good day friends. Today i am going to share you how to make a Football (soccer) game in scratch. It is a advanced scratch tutorial, but even if you are a beginner you can make this project if you just follow my instructions. This is my first instructuble so please support.

What type of game is it ?

It is a pretty simple game. It is a 2 player game. You have 2 player Red and Blue ( of course you can change the colors. ) They will be shooting a ball to the goal. you can control it by the arrow keys and wasd keys.

You can check it out here :-https://scratch.mit.edu/projects/471356367

Supplies

All the supplies you need is

  • A computer/ laptop/ mobile( I am not sure. )
  • Internet connection
  • Some time
  • Patience

How to Open Scratch

Screenshot 2021-01-09 20:48:26.png

You can do this in 2 ways, you can download the offline version of scratch from their official website. We are using the latest version of scratch which is scratch 3. You can do this even in older versions. Scratch 3 is available for both windows and mac. Both the older versions (1 & 2) is available in Linux also. I am a Linux user and I want the latest version of scratch I am using their website to make this game. Yes you can make a game just using your browser. Isn't it fascinating. This is the link to there website :-https://scratch.mit.edu/

Click in the create button. It will take some time for loading. If you want to publish your work in the scratch community you need to create an account which is pretty simple.

Delete Current Sprite

Screenshot 2021-01-08 14:11:35.png
Screenshot 2021-01-08 14:13:29.png
Screenshot 2021-01-08 14:17:16.png
Screenshot 2021-01-08 14:17:34.png

First you need to click on the sprite. Click on costume. delete the current costumes.

Create Your First Sprite

Screenshot 2021-01-08 14:17:34.png
Screenshot 2021-01-08 14:22:15.png
Screenshot 2021-01-08 14:22:30.png
Screenshot 2021-01-08 14:24:08.png
Screenshot 2021-01-08 14:24:25.png
Screenshot 2021-01-08 14:24:49.png
Screenshot 2021-01-08 14:27:06.png

Convert the costume window to bitmap. Draw a circle using the red circle draw tool. Draw 2 white eyes using the paint tool.

First Codes............

Screenshot 2021-01-08 14:29:12.png
Screenshot 2021-01-08 14:36:30.png
Screenshot 2021-01-08 14:39:30.png
Screenshot 2021-01-08 14:39:51.png
Screenshot 2021-01-08 14:44:28.png

Go to code window. Drag down the 'when flag clicked' block. Here is a tip:- when you cannot find where a block is look it's color and go to the panel of the color, and you will find that block in there. you need to create some variables. go to variables panels. click on new variable. first one is redspeedX and the redspeedY. Now you need to place list of block under the 'when flag clicked' block. I had put the photo of the codes above. Just look at codes and be a copycat.

Making the Football

Screenshot 2021-01-08 14:53:12.png
Screenshot 2021-01-08 14:53:27.png
Screenshot 2021-01-08 14:53:13.png
Screenshot 2021-01-08 14:54:42.png
Screenshot 2021-01-08 14:56:23.png
Screenshot 2021-01-08 14:56:40.png
Screenshot 2021-01-08 14:58:44.png

Hover the mouse above the create new sprite and click on paint. Convert it to bitmap. select the circle tool and select the outline. change fill colour to black. Daw a circle and fill it with white color.

Back to Coding

Screenshot 2021-01-08 14:58:44.png
Screenshot 2021-01-08 15:32:00.png
Screenshot 2021-01-08 22:39:08.png

Click sprite one. And do the coding just like shown in the second photo. We using the 'w,a,s,d' keys to control the read ball. Try controlling the red ball with 'w,a,s,d' keys, isn't it smooth.

Shrink......................

Screenshot 2021-01-08 15:34:58.png
Screenshot 2021-01-08 15:35:13.png
Screenshot 2021-01-08 15:35:26.png

we are going to shrink the ball and the sprite. set the size to 50 or any other number you want.

More Codes an Broadcasting

Screenshot 2021-01-08 15:45:20.png
Screenshot 2021-01-08 15:45:32.png
Screenshot 2021-01-08 15:47:20.png
Screenshot 2021-01-08 15:49:16.png
Screenshot 2021-01-08 15:51:10.png
Screenshot 2021-01-08 15:51:26.png
Screenshot 2021-01-08 16:02:01.png

Add the blocks shown in the first image. and then click on new message in broadcast. change it to 'redpoint'.

then go to variable make a new variable named 'balldirection'. create another variable called 'ballspeed'. And drop down the codes done in the last image just above.

Creating the Blue Player

Screenshot 2021-01-08 16:10:59.png
Screenshot 2021-01-08 16:11:11.png
Screenshot 2021-01-08 16:14:16.png
Screenshot 2021-01-08 16:14:41.png
Screenshot 2021-01-08 16:16:37.png
Screenshot 2021-01-08 16:16:50.png
Screenshot 2021-01-08 16:17:00.png
Screenshot 2021-01-08 16:23:56.png

The blue player is identical to the red player,I am simply duplicating the red player.

then create a new variables named bluesppedx and bluespeedY.

to change the color, go to costume change the color to blue.

Go to codes and change the codes as shown as in the last image.

Coding the Ball Again

Screenshot 2021-01-08 16:32:23.png
Screenshot 2021-01-08 16:36:13.png
Screenshot 2021-01-08 16:41:12.png
Screenshot 2021-01-08 16:41:26.png
Screenshot 2021-01-08 16:57:01.png
Screenshot 2021-01-08 16:57:13.png
Screenshot 2021-01-08 16:58:07.png
Screenshot 2021-01-08 16:59:29.png
Screenshot 2021-01-08 16:59:56.png

Duplicate code from 'if touching sprite 1 then'. delete last two block. and place the duplicated code over the last 2 blocks of the main code. Now we are going to change the dupliccted codes . change sprite 1 to sprite 3. change broad cast redpoint to bluepoint. change'ball direction' to sprite 3.

Check your code with the last image above.

Coding Again..........

Screenshot 2021-01-08 17:05:52.png
Screenshot 2021-01-08 17:07:28.png

go to sprite 1 (red) and the codes in the first image above. then go to sprite 3(blue) and drag the blocks shown in image 2.

Adding Backdrop

Screenshot 2021-01-08 22:03:18.png
Screenshot 2021-01-08 22:05:42.png

okay now we are going to add the football field to this game. yes we are adding the backdrop. Download the image from this link:- https://drive.google.com/file/d/0B4DzEoZJ4i8KdGV3Y...

click on the upload backdrop option as shown in the picture. select the downloaded image.

Adding Goals

Screenshot 2021-01-08 22:08:43.png
Screenshot 2021-01-08 22:21:20.png
Screenshot 2021-01-08 22:23:05.png
Screenshot 2021-01-08 22:25:49.png
Screenshot 2021-01-08 22:26:05.png
Screenshot 2021-01-08 22:44:49.png
Screenshot 2021-01-08 22:45:07.png

Go to code window and click on sprite 2 (football). Then add the codes shown in the second image.and click in color icon in the 'if touching color' block. select the color picking tool and click on the blue color as shown in the third image. Make two variables 'bluescore' and 'redscore'.we are also making a broadcast, we have done a broadcast earliear don't you rember it. Add all the codes shown in the second last image. duplicate the code and make the changes as shown in the last image. Make sure the color of our sprites and the color of your goal posts are not same. other wise this game will have some errors.

Coding Again

Screenshot 2021-01-09 18:19:49.png
Screenshot 2021-01-09 18:36:10.png
Screenshot 2021-01-09 18:40:24.png
Screenshot 2021-01-09 18:43:37.png

Go to sprite one (red) and drag the block codes shown in first image. Go to sprite 3 (blue) and do the codes shown in the second image. Go to sprite 2 (ball) and do the codes shown in third image.we have done a error in a code in sprite 2 . lets change that. Like in image 4 change 'x position' to 'direction'.

Score

Screenshot 2021-01-09 19:40:18.png
Screenshot 2021-01-09 19:42:16.png
Screenshot 2021-01-09 20:13:17.png

Now our game is somewhat completed , but it not look good right. the variables are all over the screen. To hide the variables, go to variables unmark/untick all the variables except redscore and bluescore. that is our score line. place the variables in the goal posts like in the image 2. Double click the variables to change it to a different format.

The Rule of CREATIVITY

Screenshot 2021-01-09 20:42:59.png

At last our game game is complete. Hurrah...... friends you have just created a football game. Do you know what is the rule creativity is? If you creative or you want to be creative, don't just copy anything you see add your own elements to it, customize it ,then that is what i called creative. you can add an opening title to this game or a timer or a ending were you can know who won, anything you want. This was my first instructuble so thank you. please support me. Special Thanks for Mcguy for inspiration. Definitely check out his channel:-https://www.youtube.com/channel/UC2MtlTiLxWNQAjHyF...

BE CREATIVE