Introduction: How to Make a Football Game in Scratch
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
All the supplies you need is
- A computer/ laptop/ mobile( I am not sure. )
- Internet connection
- Some time
Step 1: How to Open Scratch
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.
Step 2: Delete Current Sprite
First you need to click on the sprite. Click on costume. delete the current costumes.
Step 3: Create Your First Sprite
Convert the costume window to bitmap. Draw a circle using the red circle draw tool. Draw 2 white eyes using the paint tool.
Step 4: First Codes............
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.
Step 5: Making the Football
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.
Step 6: Back to Coding
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.
Step 7: Shrink......................
we are going to shrink the ball and the sprite. set the size to 50 or any other number you want.
Step 8: More Codes an Broadcasting
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.
Step 9: Creating the Blue Player
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.
Step 10: Coding the Ball Again
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.
Step 11: Coding Again..........
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.
Step 12: Adding Backdrop
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.
Step 13: Adding Goals
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.
Step 14: Coding Again
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'.
Step 15: Score
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.
Step 16: The Rule of CREATIVITY
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...
Participated in the
Block Code Contest