Clicker Fish: Easy games to make on scratch

Clicker Fish Game is an easy game to make in Scratch” and is an excellent way to teach programming concepts and creatively guide kids. It is sure that’s going to be an enthusiastic experience.

The Clicker Fish Game contains only one sprite, a fish. Every second, a fish emerges at a random location on the stage. The player clicks on the fish. Fish vanish either due to the passage of time or the player’s successful clicks.

In this game, two variables are employed: a Timer to track the elapsed time and a score to monitor the player’s fish-clicking. The timer variable initiates at 20 seconds, decrementing by one each second. When the Timer reaches 0, it is game over.

Variables

What is a variable? “It is just a box where we can put a piece of information. That box is stored inside our program memory and can be accessed whenever the program needs that information.”

We use variables to help our program to remember information. Some information stays the same during the execution, like user names, while others change several times, like how many times the player clicks the fish.

In Scratch, there are blocks to manage variables. For example, we can assign values to our variables to increase and decrease them.

Variables in scratch
Variables in Scratch

Part 1: Set up the project

Select Background.       

Underwater1
        Underwater1

Select Sprite

Fish

Select Sprite

Code, The Fish

Make sure you have your sprite selected. Our project has only one sprite, but we will have more than one in most cases, so verifying the element you are coding is always vital.

The sprite we have selected for our project has many different kinds of fish as customs. So what must our fish do? First, he will move to a random position and change into a random fish.

How can it do that?

  1. In the setting, change the size of the fish to 75.
  2. Select the When Green Flag Clicked Block from event categories, commonly called the Start Block.
  3. Then select Forever  Loop from the control category
  4. Select the Switch Custom Block from the look category. It would be best to put this command block into the forever loop.
  5. By default, Scratch chooses the name of the four customs available,  But you will change that with the operator Pick random.
  6.  Change the number ten to four. That’s because our sprite only has four customs.
  7. Select the Point Direction Block from the motion category.
  8. Instead of 90, the default value selected,  select the “Pick random from the operator category.
  9. Then, change the value and put -90 to 90. We have selected these values because they represent the coordinates available in the Scratch stage.
  10. Choose the Goto block from the motion category.
  11. And finally, select the Wait … Second Block from the Control category.

Our fish is ready for our first test. Your code must look like the image below:

Fish Code
Fish Code

You can test your work now and evaluate the following:

  • The fish jumps to a random position.
  • It stays for 1 second before moving.
  • It changes customs each time it moves.

Is that correct? Congratulations, you are ready to continue to breathe and review your job against the code in the image above. Relax, you are great.

Let’s create our variable:

As you discussed early in this project, we need the Timer and the Score. So, for that, we are going to need two variables.

The Score variable:

  1. Click on the Make Variable buttons on the variable category.
  2. Your screen will turn blue, and a box will appear in the middle.
  3. Please type the word Score as the name for our first variable in this project.
  4. Next, select the When Green Flag Clicked Block from event categories, commonly called the Start Block.
  5. The variable category brings out the “Set [my variable] to 0″ Block.
  6. From the drop-down menu in the Block, select Score from the list.
  7. To check if your mouse is clicked:
    1. From the Control category, select Forever Loop and If-then block
    2. From the Operator Category, bring out the “<> and <>” Block.
    3. From the Sensing Category, bring out the “Touching (mouse pointer)” block and snap it on the left side of the “<> and <>” Block.
    4. Again, from the Sensing Category, bring out the “Mouse down” Block and snap it on the left side of the “<> and <>” Block.
  8. From the Variable Category, bring out the “Change [my variable] by 1” block and put this Block inside the If- then block.
  9. Use the Drop-down menu to select the Score variable.
  10. Finally, from the control Category, bring out “Wait…Second” and change the number in the wait block to .5.

Test your work.   Press the green flag and try to click the fish where they appear. When you click them before they disappear, your Score has to increase by 1.

Your code must look like this:

The time variable

  1. Click on the Make Variable buttons on the variable category.
  2. Your screen will turn blue, and a box will appear in the middle.
  3. Please type the word Timer as the name for our first variable in this project.
  4. Next, select the When Green Flag Clicked Block from event categories, commonly called the Start Block.
  5. Bring out the “Set [my variable] to 0” Block from the variable category and change the number to 20. With this command, we will set our time to 20 seconds.
  6. Click the drop-down menu in the Block, and select Timer from the list.
  7. From the Control category, select Repeat Loop and change the number to 20
  8. Click the control Category, and bring out “Wait...Second”
Scratch Code Time Variable
Scratch Code Time Variable

.

  • From the Variable Category, bring out the “Change [my variable] by 1”, change the number to -1, and put this Block inside the Repeat Loop.
  • Use the Drop-down menu to select the Timer variable.
  • Great. You have finished. Test your complete work.

    Your code must look like this:

    Scratch Code Time Variable
    Scratch Code Time Variable

    The complete project can be downloaded from https://scratch.mit.edu/projects/656601796/.

    The project was developed following a step-by-step guide provided by Raj Sidhu in the book “Coding for Kids in Scratch 3” by Raj Sidhu.

    Comments

    3 responses to “Clicker Fish: Easy games to make on scratch”

    1. […] Easy Games to Make on Scratch […]

    2. […] Easy Games to Make on Scratch […]