Category Archives: Programming Method

How to create a bouncing ball animation in App Inventor 2

App Inventor 2 provides easy to use features for creating games. These features have proven popular for introducing programming concepts to students in K-12, especially at the elementary and middle school level. While our focus is oriented towards practical applications rather than games, we can have a little fun too!

The purpose of the sample app in this blog post is to illustrate the basic programming concepts of a bouncing ball animation.

The “Game”

Well, its not much of a game! To keep the programming simple, all this does is enable a ball to bounce around on the screen, to change its heading or trajectory, and to make it travel faster or slower. When the ball hits the edge of the screen, it rebounds in an appropriate direction. Here’s the user interface as seen on the smart phone:

Screenshot_2014-10-13-11-40-46

Press the Start button to make the ball start moving; press Stop to end the movement.

To change the speed of movement press the Faster or Slower buttons. Pretty easy?

To change the trajectory, you may enter a heading value in degrees, in the field next to the Set heading button, and then press the Set heading button.

Continue reading How to create a bouncing ball animation in App Inventor 2