Follow these steps by step instructions to create your own special game
Choose A Backdrop
Go to the mountain icon at the right bottom corner and choose a suitable backdrop.
Choose A Ball Sprite
Now the stage is ready. Let’s add a sprite. Go to the cat icon at the right bottom corner and choose a ball sprite. You can always choose any sprite but for this project, a ball sprite is recommended.
Now add a line sprite and place at the end of the backdrop.
Great! It is time to code. We’ll start by coding for the ball sprite. To ensure you are doing the right thing, click on your ball sprite below the backdrop. When you do this the ball will appear on your worksheet.
We want our ball to bounce when on the edge of the backdrop and to make sure it moves from a certain position to the other.
- Go to motion and drag point in direction 45
- Add the code forever
- Go to motion, drag and add move 15 steps
- Add the block ” if on edge,bounce”
- To run the codes, Drag and add when green flag is clicked
Click the green flag and observe what happens
Add A Paddle Sprite
You can add a paddle sprite by drawing or adding from the sprite library.
Click on the cat icon and pick a paddle. We will create codes for the paddle to allow us to control it with a mouse pointer. At the end, our paddle should be able to control our ball.
Add a “when green flag clicked” from events
Attach a forever underneath
Add set x from motion
Go to sensing and add mouse x
Make the ball bounce of the paddle
We want our ball to bounce when it makes contact with the ball and at the same time score by 1.
- Start by adding a “when green flag clicked” and add forever underneath
- To make it bounce when it comes in contact with the paddle.
- Go to sensing and drag if touching, click the down arrow and choose paddle
- Go to motion and add turn 180 degrees
- Now add move 10 steps but increase to 15 steps
- Go to control and add wait 0.5 seconds
Create Your Score
To make our game look real, we’ll create our Score. Like every other game, you observe that some events have to take place for you to score. E.g in a soccer game, the ball has to enter the net to score a goal. And the repetition of this event increases the score by a certain number.
In our own game, we want that when our ball touches the paddle, the score increases by 1.
To activate the score, go to the variable and click make a variable. Type “score” into the box and click “ok”.
Score should appear at the top of your screen
Go to the ball codes
Add a when clicked
Go to variable and add “set score to 0”
Add change score block below “if touching paddle”
Code For The Red Line
You may be wondering the essence of the red line. We want our game real fun and organised.The red line is serving as our stopping point. Once the paddle misses the ball and it touches the red line our game will end and we will have to start all over again.
Add a when clicked
Add a forever block
Then add “if” , add “touching ball” to the blank space
Drag “stop all”
Click the green flag and play the game. Great!
Now make your game more unique by adding sound effect when a player loses or wins
Change the color effects