Eating Banana Game¶
Scratch has a Video Sensing expansion module, which can turn on the camera in Scratch and detect the movement of objects on the camera screen.
Today, we will use the camera to make a eating banana game. In the stipulated time, help the Monkey eat more bananas.
To play the game against a white background, click on the green flag to start. Move colored objects in front of the camera to control the Monkey sprite.
Or click Eating Banana Game, and then learn online tutorial on the Scratch official website.
Scratch 3 (either online or offline)
You Will Learn¶
Install camera on this screen.
Add Video Sensing expansion module and use camera function
Let the camera detect our movements
Install and use the camera.¶
For the camera installation tutorial, please refer to Assemble the Camera Module.
Click the “Add Extension” icon at the bottom left of scratch and select the Video Sensing extension.
At this point, you can see the camera shot on the Scratch stage.
Arrange monkeys and bananas¶
First, we delete the original sprite, then add Monkey sprite and Bananas sprite, and change their sizes to 50.
Let Bananas appear randomly.
Bananas disappears after encountering the Monkey, which means it was eaten by the Monkey and reappears randomly.
Let the Monkey appear in the center of the stage and initialize the camera data (transparency is set to 20).
If the camera detects an object moving, let the Monkey move towards the object.
Now, click on the green flag at the top of the stage area to start the game.
Let the Monkey eat bananas, it is very hungry! Try to play this game on a white background to prevent interference from other objects.
I believe that you will be smart enough to program and implement this game soon. Next, we will add some challenges to enrich our game content.
When Monkey eats banana, we add 1 to the score. Within 30s, see who has the highest score!
When Monkey eats a banana, it emits a suitable sound effect.