How to program the game Catch Apples with Scratch

Through Getting to know and creating simple games with Scratch , you have grasped the programming interface of Scratch as well as the basic steps for programming. So let's try programming the Apple Catching game with Quantrimang.

Table of Contents

Steps to program the game Catch Apples

We will make a simple version of the Apple Catching game as follows:

When starting the game, apples will randomly fall from above, the player's task is to move the bowl to catch them by pressing the left and right arrow keys. For the apples caught, the player will get 1 point.

How to program the game Catch Apples with Scratch

To be able to program this game, you will need to follow these steps.

Step 1: Analyze the game

The first thing we need to do is analyze how the game will be structured.

  • Character Analysis: In this game, there will be two main characters, Apple and Apple Bowl.
  • Data Analysis: This game will need a Score section to be able to save the player's score, which is equivalent to the number of apples caught.

Step 2: Choose the game wallpaper

The next step is to choose a background image for the game. Click on the photo frame icon at the bottom corner of the programming interface to choose a suitable background image for your game.

There are many wallpapers with different themes for you to choose from. All you have to do is click on the image you want to use as your wallpaper.

How to program the game Catch Apples with Scratch

Step 3: Create the apple and bowl

To complete the game, of course, two main elements are indispensable: apples and bowls. Click on the cat icon next to the add wallpaper section to add these two characters to your game.

How to program the game Catch Apples with Scratch

Also don't forget to delete the default yellow cat character in the programming interface.

Step 4: Program the bowl

We start programming the bowl containing the apples, it is only allowed to move horizontally, i.e. the Ox axis (Oxhello) . In addition, we need to program the bowl to move every 20 pixels when the player presses the left or right arrow. Specifically, you will need to select the codes in the following order:

  • Under Events , select On Right Arrow Key Press and drag it to Script Area.
  • In the Motion section , drag the Change x code one amount below the When pressing the key code . Then change the number at the code to 20.

Do the same for the left arrow key, but instead of setting the number to 20, you need to enter -20 so that the bowl can move in the opposite direction. Also, don't forget to adjust the position of the bowl to the bottom of the game interface.

How to program the game Catch Apples with Scratch

Step 5: Programming the apple

We need to program the apple to fall from above and disappear when it hits the ground. At the same time, when the apple disappears, another apple will continue to fall, this process will be repeated continuously until the player stops playing. For the apple to be able to perform the above operations, we will need to program in the following order:

  • Event Section , code When clicking on the green flag.
  • Movement item , code Go to random position.
  • Let y be equal to... You need to enter the number 180 in the blank.
  • Controls section , select Continuous to add to the programming section.
  • Select Change y by -5 , program it into a small file of Continuous code .
  • Drag the If...then.. code in the Control into the Script Area to make it a child file for the Continuous code.
  • Go to Operations and drag the Space <space=""> code into the small box in the If...then code. Then take the Y Coordinate at Motion and put it in the first space and put -170 in the second space.
  • Continue dragging Go to random position in Motion into a child of the If...then code.
  • Add the code Set y equals 180 below the above code.

How to program the game Catch Apples with Scratch

Note: the screen's x-coordinate (X) is only from -240 to 240 , and the screen's y-coordinate (Y) is only from -180 to 180 .

How to program the game Catch Apples with Scratch

Next, we need to program the action of catching apples to help the player gain points and disappear and then randomly appear in another location. In addition, you can also add a sound when successfully catching to make the game more interesting. Let's program the scoring method as follows:

  • Add the If code as a child of the Continuous code.
  • Add the Touching Bowl code in the Sensor section to the blank space of the If then code.
  • Code the Play Sound in the Sound section in the If Then code.
  • Add code Go to random position of Movement item.
  • Add the code Set y equal to 180 to complete the programming.

How to program the game Catch Apples with Scratch

Finally we need to program the part that scores every time an apple is caught in the bowl.

  • First, create a point variable by going to the Variables command group and clicking Create a variable.

How to program the game Catch Apples with Scratch

  • Here, enter the new Variable Name and select For all characters and click OK.
  • Set the initial value of Points to 0, then every time an apple falls into the bowl, it will be counted as 1 point by setting the code similar to the image below.

How to program the game Catch Apples with Scratch

Step 6: Create more apples for the game

Catching only 1 apple will make your game quite boring, so add more apples to make the game more interesting. The operation to do this is extremely simple.

Right click on the apple, select Duplicate.

If you want to adjust the size of each apple, go to the Costume section to edit.

Step 7: Publish the game

Through the above programming steps, you have completed the process of creating your own Apple Catcher game . Click View Project Page in the toolbar at the top of the screen to save the game and start experiencing the game.

How to program the game Catch Apples with Scratch

At the interface you were just navigated to, click the green flag button to start testing the game you just programmed.

In addition, you can also share this game with friends and relatives by clicking Share and then getting the link to the game to send to everyone.

How to program the game Catch Apples with Scratch

Remember to name your game before sending it to everyone.

Above is the entire guide on How to program the game Catch Apples with Scratch that Quantrimang wants to introduce to you. In addition to the above instructions, you can also set up some other elements for your game to have its own unique features. Wish you success.

Sign up and earn $1000 a day ⋙

Leave a Comment

Summary of 1001+ terms in Lien Quan Mobile

Summary of 1001+ terms in Lien Quan Mobile

In Lien Quan Mobile, there are many short terms that help you communicate quickly and effectively when competing. And now, Lien Quan Council will review the most basic terms for Generals to understand.

Single‑Deck vs. Multi‑Deck Online Blackjack: Which Gives You an Edge?

Single‑Deck vs. Multi‑Deck Online Blackjack: Which Gives You an Edge?

Blackjack is one of the most thrilling casino games around. You beat the dealer, not other players. However, did you know that the number of decks used can influence your chances of winning?

Why is Nintendo Switch Online the most popular way to play retro games?

Why is Nintendo Switch Online the most popular way to play retro games?

Thanks to Nintendo Switch Online, exploring hundreds of classic games on the NES, SNES, N64, Game Boy, and Sega Genesis has never been easier.

7 Reliable Ways to Improve Game Data Load Times in Windows

7 Reliable Ways to Improve Game Data Load Times in Windows

Before upgrading your memory, try the tweaks in this guide to improve game data loading times in Windows.

5 Best Cheap TVs for Gaming

5 Best Cheap TVs for Gaming

A good TV for gaming is judged on many factors. The biggest focus is on picture quality, contrast, color, accuracy, and one more factor is input lag.

Why Dont People Play Free Mobile Games Anymore?

Why Dont People Play Free Mobile Games Anymore?

Everyone loves getting something for free. However, when it comes to free mobile games, we all know that they aren't really free.

What is Epic Games Store Error 500?

What is Epic Games Store Error 500?

Error 500 is a familiar message that many players encounter when using the Epic Games Store.

Download Football Manager 2024 for free on Epic Games Store

Download Football Manager 2024 for free on Epic Games Store

Football Manager 2024 is available for free on the Epic Games Store until September 12 so you can download it to your computer.

Top 10+ Zombie PC Games, best zombie games on PC

Top 10+ Zombie PC Games, best zombie games on PC

Zombies have always been an attractive theme in PC games and horror movies. Game publishers have exploited this theme and achieved much success thanks to the zombie horror genre.

Download game Disaster, download Disaster for free

Download game Disaster, download Disaster for free

The game Tai Uong has now been officially released and allows players to download it on their computers via the game distribution platform Steam.

How to play T-rex dinosaur game on Chrome when offline and have Internet

How to play T-rex dinosaur game on Chrome when offline and have Internet

To play dinosaur game - T-rex Run on Chrome when offline and when online, you just need to follow these simple instructions. The lovely T-rex dinosaur will appear on the screen for you to start the game.

6 benefits of playing games on laptop

6 benefits of playing games on laptop

There has long been a debate among gamers about whether to use a laptop, desktop, or console for gaming. While each option offers its own benefits, gaming on a laptop stands out in a unique way.

5 things to know before adding mods to your game

5 things to know before adding mods to your game

If you're looking for a new experience, there are a few things to keep in mind before adding a mod to your game.

How to fix low FPS problem when playing games on Windows

How to fix low FPS problem when playing games on Windows

If you are experiencing low FPS issues while playing games on Windows, follow these steps to fix low FPS issues and get back to a high-quality gaming experience.

The Game Awards 2024: Who wins GOTY?

The Game Awards 2024: Who wins GOTY?

Want to know who won GOTY 2024? The Game Awards 2024 or want a quick recap of all the winners, read from start to finish