Going Fishing with Marty

Design and build your own fishing game where you have to help Marty catch as many fish as possible!


Using Scratch 3, you will create an interactive fishing game where different sea creatures will appear on the screen and, using force sensors, you have to tell Marty when to try and catch the fish.

To start off the game, Marty will raise the arm slightly and when some fish appear on the Scratch stage you need to gently push down on the arm to tell Marty to lift the fishing rod and catch the fish!

what you will need

  • A Scratch 3 compatible device
  • Marty the Robot
  • Paper for creating a paper fish for Marty
  • String to attach the paper fish to Marty's hand/fishing rod

What will you learn about?

  • How to move individual body joints
  • How to detect force on individual body joints using force sensors
  • How to create an interactive game on Scratch using both Marty and the Scratch stage
  • How to add different Scratch sprites and backgrounds to a project
  • Controlling sprite movements and appearances

extra information for educators

This activity is covered in the Summer Lessons section of our Lesson Plan page

Getting Marty Fishing Ready: Part 1

Since the motors in Marty's arms can only move a certain amount and currently the way that Marty's arms are set up they do not go high enough for our fishing game! We can change this by altering the default position the arm sits at.

Open up Marty's head by loosening the two screws near the bottom of the head.

Then remove the arm that you will be catching fish with,

Notice that the bottom gear that the arm was attached to has two slits that should currently be vertical. Remove that gear from the side panel. Then re-attach it, but this time make sure that the two slits are now horizontal.

Re-attach the arm and screw Marty's head shut. You will notice that the arm we just attached now sits horizontally instead of by Marty's side.

getting marty fishing ready: part 2

It would be nice if Marty looked the part for our fishing game, so let's make a paper fish on a fishing rod for Marty to pull up when a fish on the screen is caught!

Draw out a paper fish, colour it in and cut it out,

You will then need to make a hole near the top of the fish and thread some string through the hole. You can then attach the string to Marty's hand so that it looks like we really are ready for some fishing!

Setting the scene

The first thing that we have to do is create an underwater theme on the Scratch stage section of the screen.

Create a new Scratch 3 project with the Marty the Robot extension added.

Change the backdrop of the stage to be something with an under the sea theme.

how do i change the backdrop?

On the right hand side of the Scratch screen, there is the Stage with Scratch cat currently loaded onto it. We want to change the background that Scratch cat is currently on by hovering on the blue circle with an image logo that can be found in the bottom right of the screen. Then find the option that says Choose a Backdrop.

We now need to select a new sprite - a fish sprite for Marty to try and catch! This is very similar to changing the backdrop except we use the button beside the backdrop one and search again like before. Once you have added your sprite your stage should look something like this,

Hint: You can change the size of your fish sprite by making the number in the Size textbox bigger!

how do i add a new sprite?

Below the now sea-themed stage there is a space that lists the Sprites that are currently loaded into our project. Just to the bottom right of this section is a butting with a cat icon on it, give it a click and look for the Choose a Sprite option. Then you can search for what sprite you want to appear in your game.

surprise fish

It would be no fun if the fish was always there ready for us to catch! Let's make things a little more interesting so that when we start the game, the fish will randomly appear.

Before we start the game, we want to make sure that the fish isn't visisble to the player! To do this you need to change the setting for the sprite so that it isn't showing,

Okay, so now we have no fish on our screen. When we start the game, by clkcing on the green flag, we want the fish to move to a random position, wait between 1-6 seconds and then show itself,

Hint: Play around with the different times you have to wait for the fish to appear? Is 6 seconds too long or not long enough?

Challenge: swimming fish!

We already have our fish appearing after a random amount of time but when it does appear it sits still. Wouldn't it be good if our fish could swim around the screen?

Add a few extra blocks to your program so that when the fish appears on the screen, it starts swimming around. You might want to think about the following,

  • You will want to use the blue Motion blocks
  • You might want to think about how to program the fish sprite to move around into random positions
  • A forever block will be useful here!

I need some help!

In Scratch, we can run programming blocks in parallel, meaning that we can do more than one thing at a time. By using the same event block at the top of our sequence of coding blocks, we can run two individual sequences at the same time. We will need to do this to get a swimming fish. Whilst we are doing the set-up we can also just tell the fish to start randomly swimming around in the background whether it is visible to the user or not.

Hint: If you want to move your fish around faster then try changing the time parameter on the blue glide block

This does mean that we can change our first sequence of blocks now because we are already telling the fish to be moving around to random places on the stage all the time, so we don't need to send it to a new random spot before we set it to be visible to the players! This means our program now looks like the following,

getting ready to catch a fish

In order to catch some fish, Marty needs to lower the fishing rod into the water!

To do this, we need to get ready and move the fishing arm downwards.

Catching a Fish

Using the force sensors in the arms, we need to program Marty to respond to a force on the arm and to react by trying to catch a fish!

Firstly, we need to learn how to read the motor currents to understand how much force is being placed on the arm. We can do this by storing the value being read from that joint into a variable so that it makes the value easy to regularly check.

To make a new variable, select the Variable option in the code blocks drawer followed by the Make a Variable button. You will be asked what you want to call your variable - choose something meaningful so that later on you remember what it's storing!

The variable should be set to store the current from the right or left arm motor (depending on which arm your using for fishing!) with the value being multiplied by 1000 so that we get a number returned that isn't super small.

It's important that we regularly update the number that is being stored in our variable so that we can stay up to date with whether Marty is being told to try and catch a fish!

We can easily do this by wrapping the set variable block in a forever loop and programming it to run in parallel to the rest of our code - meaning that it will run at the same time as other blocks! Your whole program will look something like this,

From the values being returned from our sensor, we can program Marty to respond to a force on the arm using if statements.

What are If Statements?

In programming, we can use something called if statements to help us make decisions. They are commonly known as a programming construct and following the same standard approach of testing a condition before deciding which action to test. But we use if statements everyday in real life too! Everytime you go to cross the road you make the decision whether it's safe or not, in the structure of an if statement this would be like,

IF there's a green man THEN it's safe to cross the road ELSE it's not safe to cross the road

Checking if We Really Caught a Fish

From testing your program, you might have noticed that anytime you push on Marty's arm, we can try to catch a fish regardless of whether the fish is on the screen or not. We should probably check that there is a fish on the screen to be caught before celebrating!

In order to know whether the fish is on the screen we will need to keep track of when it is and isn't visible on the Scratch stage. We can do this easily using a variable!

Create a new variable and set it to be 0 when we start the program,

Then set the variable to be 1 after we set the fish to be visible on the screen. That way we know that when the variable returns 0 there is no fish on the screen and when it returns 1, there is a fish on the screen!

Now we can extend our program so that when Marty is told to try and catch a fish, we can work out whether or not there is a fish on the screen. We will need to use a logical operator so that we can have more than one condition being checked in our if statement.

How do AND Logic Operators Work?

In Scratch, we can run programming blocks in parallel, meaning that we can do more than one thing at a time. By using the same event block at the top of our sequence of coding blocks, we can run two individual sequences at the same time. We will need to do this to get a swimming fish. Whilst we are doing the set-up we can also just tell the fish to start randomly swimming around in the background whether it is visible to the user or not.

adding emotion

Now that we know whether or not a fish is being caught, we can program Marty to respond appropriately and show some emotion!

By extending our if statements, we can add in different reactions depending on whether Marty has caught a fish or not. In the example below, Marty catches the fish and wiggles whilst having excited eyes but when Marty goes to catch a fish that isn't on the screen, Marty responds by showing angry eyes and kicking!

What Next?

You have now just created and programmed your own fishing game with Marty the Robot. If you want to continue to explore how the force sensors work or extend your fishing game some more, here are a few ideas!

  • Adding sounds to your game. You could play different sounds depending on whether a fish has been caught by Marty
  • Add different levels to your game. You could have different sea creatures pop up on the screen - some that Marty should try to catch and others that Marty should avoid
  • Change the amount of time that the fish appears on the screen for. Make things a little bit more tricky by only having the fish appear on the screen for a few seconds before disappearing again
  • Add a score counter to your game. How many fish can your Marty catch?