Project 10: Game “Touch the Ball”
Updated: Nov 9, 2022
This is a game project. The user has to touch the ball with the bat. The bat will move with the mouse pointer. Wherever the mouse pointer goes bat will moa ve there. Also, there is ball appears in random position.
You should be familiar with below coding blocks, backdrops, and sprites
1. Add/change new backdrops
2. Add/change new sprites
3. Familiar with Events blocks, Control blocks, and Motion blocks.
Step 1: Imagine the project
This is only a sample. You can imagine a different way for the same project. Sky is the limit to your imagination
Step 2: Design the project
For this game project, we are going to use backdrops, sprites, and code blocks.
1. Decide the backdrops you want to have it. In our case, we have 1 backdrop.
2. Decide the sprites you want to have it. In our case 2 sprites.
3. Decide what are the game rules. The user has to move the bat and touch the ball
4. Decide what blocks you want to use. In our case Events blocks, Control blocks, and Motion blocks.
Step 3: Prepare coding cards
For this please refer the scratch site - https://scratch.mit.edu/ideas to get idea.
Step 4: Start to develop the code
Step 4.1: Go to https://scratch.mit.edu and sign in with your username and password.
Step 4.2: Click on create and go to the scratch editor
Step 4.3: Give the name of the project
Step 4.4: By default, the cat is the sprite. Select that and delete it.
Step 4.5: Add a new backdrop and delete the default blank backdrop. Select the backdrop named “Baseball 1”.
Step 4.6: Add a new sprite bat using upload sprite. You can download an image from https://unsplash.com/ (if you use images from other sites make sure it's a free image and you are allowed to use it, always go to the site https://unsplash.com/) to your local machine and upload it to scratch. You can customize it if necessary.
Step 4.7: Add the below code to the above sprite.
Step 4.8: Add a new sprite ball using paint. You can draw a circle.
Step 4.9: Add b