Introduction: A Dodge Ball Game

today we are going to make a dodge ball game with scratch, using coding and one sprite/player and five balls. were going to have a game starting page, an ending page, and the sprite say things at the end. were also going to have lives, ball speed, and a score at the top of the game page. were gonna show you how to do all that and code the game so where you and your friends can play it.

Supplies

you need a scratch account, a keyboard, a mouse, and a computer to do this code.

Step 1: Backdrop #1

click choose a new backdrop shown in the photo on the left, then choose the backdrop called "blue sky" shown in the photo on the right. your going to label this backdrop "game screen", to name it click on custom and you can change it, to get there click on backdrops shown on the fourth photo then click, backdrops shown in the fifth photo and then you can change the name shown in the third photo.

Step 2: Code for Backdrop #1

this is the code for the first backdrop, this code is so that when the game starts the lives start at 0, and the backdrop switches to the game screen backdrop when the game ends. follow this code perfectly the same

Step 3: Backdrop #2.1

your first going to start by getting a new backdrop, you do the same steps as you did then for the first backdrop, your going to get the same one called "blue sky". your going to click "backdrops" shown in the third photo, the click backdrops again in the fourth photo, your going to label this backdrop "game over"

Step 4: Backdrop #2.2

your still going to be on backdrop 2, your going to click on the "T" to write '"game over"

Step 5: Code for Backdrop #2

this code is so that when the game starts the backdrop switches to this backdrop the "game over" backdrop. follow the code directly the same, so that when the game is over it will show the words "game over" so that the player knows the game is over.

Step 6: Variable

for this code your gonna need to make three different variables called "ball speed" "lives" and "score" these variables will be used multiple times in this code.


Step 7: The Sprite

first start by dragging down your sprite (the cat) to where the feet touch the bottom of the page like the sprite is walking on it. this is so when you are playing the game the sprite isn't floating in the air

Step 8: Coding the Player Sprite

this is the first code for the player/sprite copy it down exactly, this code will help the sprite move around so it can dodge the balls, the sprite moves ten steps at once, it codes how many lives, score and how many times the sprite was hit by the ball in the code.

Step 9: The Ball

start by choosing a new sprite and choose the one called "ball" a photo is shown on the right of what the sprite looks like the photo on the left is what you should click to get a new sprite.

Step 10: Coding the Ball

this is the code for the ball copy it perfectly, the code for the ball is so that when you play the game the ball will fall from the top of the screen to the bottom and continue on doing that but switching places every time so it doesn't drop from the same spot every time, the code is also there so that every time the ball drops the speed changes every time, the code is also there so every time the ball hits the player it takes away a life.

Step 11: Second Code for the Player

this is the second code for the player. in the picture on the left is the code copy it directly. on the photo in the right is where the code should sit beside the first code. the code is so that when the game is over the player/sprite will say things in the third photo is what it should look like when the sprite speaks.

Step 12: Second Code for the Ball

the photo on the left is the second code for the ball follow it directly how it is, the photo on the right is where the second code should sit next to the first code. the code is so that when the game is over all the balls disappear.

Step 13: Duplicating the Ball

to duplicate the ball move your mouse so its on top of the ball then click the right side of the mouse. three words should pop up just like it shows in the photo above click the one that says "duplicate" do this about five times or as many as you would like. when you copy the ball sprite you don't need to redo the code since you duplicated it which also duplicated the code.

Step 14: Finish

that is how you code this game it is now all ready for you and you friends to play on your free time.