The goal of this game is to catch as many fish as we can. We would like to be able to control the fishing boat with our left and right arrow keys which is sitting on top of the water.
Our boat will have a fishing hook that can move up and down with the up / down arrow keys. The fish will swim from left to right, if they touch our fishing hook, they will become hooked and caught.
We should keep score of how many fish we catch.
Backdrop Setup
We can use the underwater backdrop, but use the drawing tool to clear some space at the top of the backdrop for our boat to sit on.
Sprites
I’ve used the sailboat as the main fishing boat. But feel free to draw up your own boat.
For the fishing hook sprite, I’ve drawn a nice letter J, but I added a tiny little bit of red bait. I’m going to use the red bait later in my code to check to see if the fish is touching this.
We should also add a fish that we are going to catch.
One more thing, we are going to add a pesky crab to our game. If we catch him, then we will lose our hook.
Making Our Boat Move
We can make our boat move from left to right by pointing the boat in the correct position (either left or right) when the keys are pressed. Then we can move to the boat with the ‘Move steps’ blocks.
Fishing Hook
We want our fishing hook to follow the boat around until the player decides to drop the line into the water, we can use the wait until block for this.
We can control the depth of the hook by moving the hook either up or down, depending on which keys the user presses. First we point the hook in the direction we want to move, then we move it a number of steps:
Test: Our game should let us move both the boat and the hook. If we move the boat after the hook has been dropped, the boat should still move, but the hook doesn’t move.
Fish
It’s not much of a fishing game if we don’t have some fish to catch. Since we want to have a lot of fish swimming around, we are going to use the ‘clone’ command. This just allows us to create lots of fish that are the same, but our code will have some random numbers to control its location. So the end effect should look like lots of random fish are swimming around.
We first use the green flag block, which will create a new cloned fish every 1 to 4 seconds. When the clone is created we need to do the following:
- Move to a random location to the left of the screen (-240 X)
- Point towards the right hand side of the screen
- Move across the screen both fast and slowly, but random speeds.
- If we are further than 240 (X), remove the fish from the screen.
The code for the should achieve the points above.
Test: Does the fish swim from left to right?
Getting Hooked
Our fish now needs to get hooked so that we can catch it. Let’s add a check to our code to see if the fish is touching the hook. If it does touch, let’s change the position so that it is facing the boat. While we are on the hook and not yet at the boat, we want the fish to follow the hook.
Ensure the Hook Moves Correctly
We really want the hook to continue following the boat once it has caught a fish. We always want the hook following the boat until the down arrow is pressed. Then the next time it touches the boat, it must follow the boat until it has been dropped again.
The Crab
Hooking the crab should stop the game immediately. No second chances.
Extras
Add a variable to keep count of how many fish have been caught.