Finch Pong II
Use the Finch to play the game Pong!
4-5, 6-8, 9-12
This project is aligned with Common Core math standards that involve angles (4.MD.C); the coordinate grid (5.G.A and 6.NS.C); and proportions (6.RP.A and 7.RP.A). At the high school level, students can create custom blocks to represent functions relating the accelerometer value to a screen position (HSF.IF.B and HSF.BF.A).
For this activity, you will be using the program you wrote for Finch Pong I. If you didn’t complete that activity, do that now!
In Finch Pong I, you wrote a program with a ball sprite that fell at a random x position. The user controls a paddle with the Finch and tries to catch the ball. In this activity, you will make the game more complex by making the ball bounce and moving the ball horizontally as well as vertically. You will also increase the speed of the ball as the user plays.
In your first version of the game, the user just tried to intercept the ball with the paddle. Now you want to make the ball bounce off the paddle and the sides of the screen.
Start by changing the direction of the ball when it hits the paddle. When the ball hits the paddle, you want it to reverse its direction. What block can use you to do this? Where in your program should you place this block?
Next, you want to make the ball bounce off the edges of the screen. This is easy! You can use the if on edge, bounce block, which is found near the bottom of the Motion menu. Where in you program should you place this block?
Adding Horizontal Movement
Right now, your ball only bounces back and forth between the top and the bottom of the screen, which isn’t very exciting. You need to add some horizontal movement!
Modify your program so that the ball is pointing in the 135° direction when it starts to fall from the top of the screen.
When the ball hits the paddle at an angle, it should turn 90° when it bounces off the paddle. If the ball is falling from the left (135° direction), it should turn 90° to the left. If the ball is falling from the right, it should turn 90° to the right. Make these changes to your program, and be sure to test that the ball is bouncing properly.
Hint: To find the direction of the ball, you can use the direction variable block at the bottom of the Motion menu.
Changing the Speed of the Ball
Create a variable called speed. You will use this variable to change how fast the ball falls. You should place speed inside the block you use to move the ball. For instance, if you use a move steps block for the ball, you should place speed inside that block.
Remember that you need to set an initial value for speed at the beginning of the program. What is an appropriate starting value for speed? You want the ball to start slow and speed up when the user is doing well. Add a block to increase speed when the user hits the ball with the paddle.
How can you detect that the user has missed the ball? When this happens, you want to reduce the speed of the ball and start a new ball from the top of the screen. You can do this by ending the game and telling the user to restart, or you can give automatically start a new ball when the user misses.
Hint: What is the y position of the ball when the user has missed?
Adding Lights and Sound
Make your game more fun by adding lights and sound. For instance, maybe you want the Finch to beep and flash its beak when the user hits the ball. Use your imagination!
Make Your Own Game!
You can also use the Finch as a game controller for many other kinds of games! Try making a maze game, Finch Pac Man, or create your own original game. Share your game with us via email (email@example.com) or twitter (@birdbraintech).