6. Eat fish¶
In this practice we are going to play a game that consists of chasing fish with a penguin so that it eats them.
We start the Scratch editor.
Press the language button in the top bar and choose English.
Press the tutorial button and then the "Games" button.
We select the tutorial "Create a chasing game" and visualize it.
In this tutorial we will see the basic operation of the program.
We delete the cat object by clicking on the trash can icon.
Now we are going to carry out the program. First we select a backdrop for our game. In the button select backdrop we choose one from the bottom of the sea "Underwater".
Next we add a fish. Clicking select object in the Animals tab we select a fish that we like.
Now we are going to move the fish around the screen randomly. To achieve this we program the following instructions.
Press the green flag to test the operation of the program.
We added a new character that will chase the fish to eat it. Clicking select object in the Animals tab we select a penguin.
We create a new variable. In the button variables we press "create a variable" and call it points.
The following instructions reset the points to zero, reduce the size of the penguin to make the game more difficult, and choose one of the available costumes for the penguin.
Finally we are going to add movement to the penguin. Each time an arrow key is pressed, the penguin's position will change by one step.
Press the green flag to test the operation of the program.
As we can see, the penguin can chase the fish but still can't eat it. In order for the fish to be eaten, it will be necessary to add some more instructions.
We select the penguin and in the code tab we add the following program.
Now we select the fish and in the code tab we add the following program.
Press the green flag to test the operation of the program.
Challenges¶
Add more fish costumes to the current fish. Every time the penguin eats the fish, a different fish will appear.
To achieve this, use the command "next costume" in the appropriate place.
Add a new character that subtracts points when eaten. For example, it can be a jellyfish or "jellyfish".
The program will be similar to eating a fish, but this time it will subtract points instead of adding.
The new character that subtracts points must appear when 10 seconds have passed from the start of the game.
Add a new character, for example, a shark that eats the penguin when touched. In this case the penguin disappears and the game is over.
The new character that subtracts points must appear when 20 seconds have passed from the start of the game.