Pong is a simple game controlled by the user and a ball. The ball bounces off the paddle and three walls. Create an interactive game with user input (touch) and computer generated outputs (ball heading, score, text prompt)
Now let’s continue with a game app that we will create named Pong! You may know of this game and even played it some time. Ask your parents if they have ever heard of Pong and be sure to have them test it out for you. It might bring back memories!
The purpose of the game is to use a paddle to keep a ball in play for as long as the user can. For the first app of this type, where a score is kept, added features need to be considered. Since the ball will bounce off the edges of the screen we do not want the ball to be stuck on an edge without being able to bounce away. Code must be written that will keep this from happening.
To create the app Pong, you will need to download and upload the paddle image file.
Download the file by right clicking on the link to the paddle image and selecting ‘Save As.’ Save the file to a place on your computer that you can easily find later, such as your desktop. paddle.png Find it directly here: goo.gl/4snLLT
1. Create the project
a. Go to ai2.appinventor.mit.edu & select ‘Continue
b. Select ‘start new project’
c. Name the project Pong
Note that ‘capital letters’ are used at the beginning and where spaces would normally occur.
2. Connect your AI or Emulator
3. Add Your Components (create your interface)
Use the table and screenshots below to guide you through adding your components and modifying the properties explanation and properties.
Designer Setup: Use this table below to set up and check your components & properties
Your Designer Screen Should look like this screenshot below:
4. Build your Blocks (program)
Blocks Setup: Use the directions and blocks image to set up your blocks
Try it out!
On your AI Companion (or emulator), does your Ball Bounce App work?
If not, retrace your steps to find where you went wrong. Usually it is a simple omission or typo.
ChallengeTry some ‘extensions’ or ‘variations’ to modify the purpose of the app or change the behavior.
Increase the speed of the ball and decrease the size of the ball when the score increases as an increment of 10.
Add an audio file and make the ‘sound’ play when the ball hits the edge of the wall and a different sound when the speed of the ball increases and other sounds when the ball falls and hits behind the paddle.
Give the play 3 lives so they get 3 tries before ‘Game Over’