Introduction: The Hungry Shark Game in PictoBlox: Scratch Based Programming Software

About: STEMpedia is a place bringing project-making tools at one place- kits, online courses, coding platforms, controller app and tons of free learning resources.

And we’re back with another Scratch game for our budding young gamers and coders. This project will show you how you can make a Scratch fish and shark game whose aim will be to feed famished shark as many fish as you can. More you feed the shark, the higher will be your score. We’re going to make this game in PictoBlox, our Scratch-based graphical programming software which you can download from HERE, and control the shark’s movement with evive.

Ready for some fish hunting and feeding? Let’s begin!

Step 1: Changing the Background

As the title suggests, we are going to have a shark and a lot of fish in our game. Thus, the background needs to add something like the ocean. This will add more fun to the game.

  1. Open PictoBlox
  2. Click on the Choose a Backdrop Button
  3. Select Underwater from the library

The Stage now looks something like the image.

Step 2: Adding the Characters A.k.a the Sprites

Now, we need the shark and its prey in the game.

  1. Click on Choose a Sprite button
  2. You may find a number of sprites in the library. Choose the fish and the Shark2 sprites one after another.

    Note: Fun part, you can even make your own face as the sprite, just choose the respective options to do so.
  3. Also, we need to say goodbye to Tobi, the bear. Right-click on his icon, and select delete from the drop-down.

Your stage will finally look like the above image.

Step 3: Making the Shark Move

Before we start writing the script, we need to first connect evive to your computer via a USB cable. As we need to control the movement of the shark using the evive's potentiometer.

  1. Once evive is connected, click on Boards button in the menu and select evive from the drop-down.
    On a side note: You can program any of your favorite board using PictoBlox.
  2. Click on the Connect button. A dialog box will appear, asking you to connect to the COM port. Click on the appropriate port.
  3. Once done, click on the Shark2 sprite to write the script for it.
  4. We need the Shark to follow the direction in which we rotate the potentiometer thus, drag and drop some blocks and write the script given above.

Step 4: Duplicating the Prey

There cannot be just one fish in the ocean. Thus, we need to duplicate or clone the fish sprite. Write the script given to do the same.

Note: Next Costume block is used to make the fish look every time they clone themselves.

Step 5: Making the Prey Run for Its Life

Now, once the fish has appeared in shark's region, it needs to swim for its life away from the shark. As soon as the fish appear, it should glide to some random place on the stage and should disappear once it went away from the fish.

Thus, write the script above for the same.

Step 6: Making the Shark Eat the Fish

Every time the shark eats a fish, the Score should increase. Also, the shark should be broadcast the message that it has eaten the fish. Write the code given.

Step 7: Receiving Shark's Message

When the fish sprite broadcasts the message Eat, we want the shark sprite to make a sound and to look as if it has eaten the fish. Write the final script given above for the Shark's sprite.

Step 8: Conclusion

With this, you are all set to play this game. Enjoy! :)

Games Contest

Participated in the
Games Contest