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, multiplayer fishing game where different sea creatures will appear on the screen and, using bump switches, you have to beat your opponent to quickly 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 press a bump switch to tell Marty to lift the fishing rod and catch the fish!

what you will need

  •  A Scratch 3 compatible device with Wifi - a laptop or tablet
  • 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 using bump switch 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 tutorial enables students to explore moving Marty's individual body joint and how to use force sensors. It also introduces sprites and backgrounds and gives students the opportunity to make an interactive game using blocks from many different code drawers.

STEP 1: getting marty fishing ready

It would be nice if Marty looked the part for our fishing game, so let's make a paper fish on a fishing line for Marty to pull 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!

STEP 2: 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 (don't forget to delete the Cat Sprite):

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.

Step 3: 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 be hidden and then 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 clicking on the green flag, we want the fish to wait for a random length of time 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?

Coding 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 randomly?

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 might need to make another block of code starting with green flag too so the movement runs in parrallel with the hide and show code
  • You will want to use a blue Motion block that tells the fish sprite to keep swimming around to random positions
  • A forever loop block will be useful here!

Dory Lessons GIF - Find & Share on GIPHY

If you get stuck remember that you can click below to see the answer. Test your code to see if it works!

Click here to see our suggested answer!

Coding the fish keep swimming around the screen at random can be done in lots of different ways. We chose to use both the forever loop and the Glide motion block as shown here:


STEP 4: Preparing to Catch a Fish

Using the bump switches on Marty's feet we can program Marty to react whenever the switch being pressed. We can make Marty react to this by pulling its arm down to reel in a fish!

To prepare Marty to catch fish we need to get ready and move the fishing arm outwards.




Next we will put our Move right arm block inside an If Then Loop and add another Move right arm block at the end:


Can you remember which GPIO input you plugged the bump switch into for Marty's right foot?

In this example we plugged it into GPIO input 0. We've added an Operator block to our If Then statement so that if the bump switch is pressed ('GPIO input 0' = 1) then Marty will pull their arm inward and then put the arm back into the fishing position again at the end.

We also use a forever loop here so as soon as Marty has reacted to the switch they will go back to waiting until the bump switch is pressed again before moving the arm:


Try testing it out! Does Martys arm go down and then back up each time you press the bump switch?

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 take. 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

STEP 5: Checking if We Really Caught a Fish & Scoring a point!

From testing your program, you might have noticed that anytime you push on the bump switch, Marty can try to catch a fish regardless of whether the fish is on the screen or not. We should probably make Marty check that there is a fish on the screen to be caught before celebrating or being able to score a point in our game!

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,

Using the same code as we made earlier for the fish sprite  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 is 0 there are no fish on the screen and when it is 1, there is a fish on the screen!

  •  Next we should make the fish wait for Marty to get ready before appearing by adding a wait 5 seconds block at the start.
  • We can also add a forever loop to make sure the fish appears and the dissapears again.
  • Let's make the fish wait 1 second before hiding so we have a chance to catch it too!
  • For fun we can also use one of the Look blocks called Next Costume to make a different fish appear after the last one has appeared and dissapeared  again, then we can catch lots of different types of fish!

The code for your fish should now look like this:

Now we can change the code we made earlier so that when the switch that tells Marty to try and catch a fish is pressed, we will stop Marty moving the arm unless there is also a fish on the screen at the same time.

To do this we will need to use an 'and'  operator block so that we can have more than one condition being checked in our if statement. We will also need to another 'equals' operator block for visible fish = 1 as shown here:


click here to learn 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.

In order to start scoring points whenever we catch a visible fish we will need to create another variable called 'Player 1 Score'!

  • Make the new 'Player 1 Score' variable
  • Set it to zero at the start of the game before Marty Gets Ready
  • Finally, use the change my variable by block to increase it by 1 when we catch a fish. This happens when the right arm moves after the code for [GPIO input 0 = 1] AND [visible fish = 1]

As shown here:


Now would be a good time to test your code! Does your score go up by 1 when you push a bump switch in at the same time a fish is visible on the screen?

STEP 6: Adding Player 2 to the game

Now that we know we can score points when we catch fish, wouldn't it be fun if we can have a competition with a friend to see who is the fastest to catch the fish? First to catch 5 fish wins!

So far we have 1 person playing the game with the right foot bump switch and the right arm for fishing. To add another player we will need to use another bump switch (we are using GPIO input 1) for the left side of Marty!

We will need to create a new variable called 'Player 2 score':


Now we need to code Marty's left foot bump switch (the one player 2 will use) to respond to being pressed. Rather than coding all the same commands that we did for Marty's right arm all over again we can simply right click and duplicate those blocks to save time:


We then need to remember to change the blocks from right arm to left arm on this new sequence of code that we made, don't forget to use our new player 2 score variable as well:


STEP 7: when will someone Win the Game?

Now that we can score points whenever we catch fish, and now that we have another player in the game, it is time to see who is the fastest to catch the fish. Let's make some code so that the first person to catch 5 fish wins and makes the game stop running!

First we need to create 2 new backdrops to show different game over screens for player 1 winning and for player 2 winning. We will do this by clicking on the small picture of the backdrop on the right side of the screen in Scratch. After clicking that we will click on the backdrops tab in the top left (above the list of code blocks):

Now that we're looking at our backdrops we should duplicate our underwater backdrop twice so we will have 3 underwater backdrops in total that look the same:



Next we will rename the 2 copied backdrops 'Player 1 wins screen' & 'Player 2 wins screen'. We can also include text on the backdrop to show these messages:



REMEMBER we also have to do the same for your other duplicated screen for a 'Player 2 wins' message & once we have done that then we should click to return to the 'Code' tab to make new code for your backdrops:



Now that you are back on the code tab you will notice it is blank - don't worry! Your earlier code is still there if you click on the fish sprite but for now we are coding the backdrop. The final bit of code to finish this game is for your backdrops. It will tell Scratch to keep checking the score, then (by using parallel programming) show the screen of the player who gets a score of 5 first and then end the game with a stop all Control block:



You're finally ready to play the fishing game now!


Have fun fishing and please share your feedback, photos and videos with us on Twitter, Instagram or Facebook. We love to see Marty fans using their robots to their full potential! 


(Optional) Challenge: Watch out for jellyfish! 

Are you finding it too easy to catch fish? Are some players just pressing their bump switch all the time to win the game? Try adding in a sprite that you wouldn't want to catch that will steal points from you if you catch them!

Jelly fish finding nemo movies GIF on GIFER - by Adoraswyn


  • You will need to add a new sprite
  • How will you make the new sprite hide and then show itself like we did for the fish? You might need to use the Looks blocks and Forever loops
  • You might also need to use Variables so that Marty knows when a jellyfish is or is not visible like we did for the fish
  • You might want to use '2 If Then Loops' and 2 'AND Operator blocks' so that whenever the bump switch is pressed and the jellyfish is visible we can change the scores by -1 for player 1 or player 2 depending on who tried to catch a jellyfish!

Click here to See the Answer Code!

Start by picking a new sprite that you wouldn't watch to catch on a fishing trip! In this example we have chosen a stinging jellyfish:

Then you can add the following code for your Jellyfish sprite to make it hide and show itself, move and change costume:


Finally add the following code so that whenever player 1 or 2 has pressed their bump switch while a jellyfish is on the screen will lose 1 point:

Don't forget to add the wait 1 second blocks too or it will deduct more points than 1

Feel free to play around and experiment with the timings or the number of points the jellyfish takes away - have fun & keep on creating!



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. 
  • 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