Scratch Idle Bouncing Ball Game
by NonameExperiments in Circuits > Software
794 Views, 2 Favorites, 0 Comments
Scratch Idle Bouncing Ball Game
![Title.png](/proxy/?url=https://content.instructables.com/FZC/FTNJ/LEMTZ2FP/FZCFTNJLEMTZ2FP.png&filename=Title.png)
In this project, you make a game where the ball bounces around and you make money. You can buy more balls, upgrade how much you make, and increase the speed. It is a fun game, that you can learn to make in Scratch.
Supplies
All you need to do is open Scratch, and create a new project. Then, create variables called Balls, Money, New Ball Cost, Profit, Profit Cost, Speed, and Speed Cost.
The Stage Background
![stagebackground.png](/proxy/?url=https://content.instructables.com/FB5/LZV1/LEMTYTEP/FB5LZV1LEMTYTEP.png&filename=stagebackground.png)
This is one of the premade stages called stars. Just add it to stage backgrounds and switch to it. Then, you will have the starry background.
The Stage Code
![Stage.png](/proxy/?url=https://content.instructables.com/FL8/1SMA/LEMTYTEN/FL81SMALEMTYTEN.png&filename=Stage.png)
You will need to take the code above and add it to the stage.
The Ball Background
![ball.png](/proxy/?url=https://content.instructables.com/FJA/M4VR/LEMTYTEG/FJAM4VRLEMTYTEG.png&filename=ball.png)
Make a new sprite, and just make a circle with a black background
The Ball Code
![Ball Code.png](/proxy/?url=https://content.instructables.com/FC5/BG6V/LEMTYTEF/FC5BG6VLEMTYTEF.png&filename=Ball Code.png)
Add this code to the ball you just made. It will control how much profit the ball makes when it bounces, the speed, and the amount of clones.
The New Ball Button Background
![New Ball background.png](/proxy/?url=https://content.instructables.com/FSU/VO47/LEMTYTEH/FSUVO47LEMTYTEH.png&filename=New Ball background.png)
Just create a simple rectangle with the words in it that says new ball.
New Ball Button Code
![New ball button.png](/proxy/?url=https://content.instructables.com/FEI/BIXP/LEMTYTEI/FEIBIXPLEMTYTEI.png&filename=New ball button.png)
Then add this to the sprite you just made. When it is clicked, and will make a clone of the ball.
The Profit Button
![profit background.png](/proxy/?url=https://content.instructables.com/FTJ/LDRB/LEMTYTEJ/FTJLDRBLEMTYTEJ.png&filename=profit background.png)
Make a rectangle like the last one, but change the words to Profit.
The Profit Button Code
![profit button.png](/proxy/?url=https://content.instructables.com/FCI/TH05/LEMTYTEK/FCITH05LEMTYTEK.png&filename=profit button.png)
Just add this code to the profit button sprite. It will increase the money when you click on it.
The Speed Button
![speed background.png](/proxy/?url=https://content.instructables.com/F4H/J0F0/LEMTYTEL/F4HJ0F0LEMTYTEL.png&filename=speed background.png)
Make another rectangle like the last two, but change the words to Speed.
The Speed Button Code
![speed button.png](/proxy/?url=https://content.instructables.com/FAO/L3XP/LEMTYTEM/FAOL3XPLEMTYTEM.png&filename=speed button.png)
Just add this code to Speed Button. It will increase the speed of the ball.
The Border
![border.png](/proxy/?url=https://content.instructables.com/F9E/EBII/LEMTYWJQ/F9EEBIILEMTYWJQ.png&filename=border.png)
Just make a long rectangle across the top, and in the corner, write Money. This will be border where the buttons go, and where you can see you money.
The Border Code
![border code.png](/proxy/?url=https://content.instructables.com/FXQ/MNK8/LEMTYWIT/FXQMNK8LEMTYWIT.png&filename=border code.png)
Then add this code to the Border.
Aligning Up the Variables
![Title.png](/proxy/?url=https://content.instructables.com/F4P/XDDQ/LEMTYTBO/F4PXDDQLEMTYTBO.png&filename=Title.png)
You need to put the variables: speed cost, new ball cost, and profit cost to large readout by clicking on them and selecting large readout. Then, put them in front of the corresponding button. Take the money variable, put it at large read out, then put the money variable underneath the money word on the border. If you are confused, just look at the picture.
Troubleshooting
![fixed.png](/proxy/?url=https://content.instructables.com/F6N/JEUA/LEMTYZUW/F6NJEUALEMTYZUW.png&filename=fixed.png)
If the ball is not bouncing of the border with the buttons, then you will have to change a little code. Change if touching Sprite 3 to what ever your border is named.
The Finished Game
![Title.png](/proxy/?url=https://content.instructables.com/FL0/542U/LEMTYTEQ/FL0542ULEMTYTEQ.png&filename=Title.png)
Now, the game should be done. Hopefully, the game should work well, and you can find the game at https://scratch.mit.edu/projects/768103282/ .