Android Bouncing Ball Demo
I just added a new demo to my Android Game Examples project. This sample reacts to the accelerometer to control a ball. As you rotate the screen, the ball falls towards the earth. When it bounces off the edge of the screen, the phone vibrator kicks in for a few milliseconds.
I’m doing this to learn how to write games. The source code demonstrates a few things:
- Using the phone’s accelerometer
- Activating the phone’s vibrator
- Simulating gravity and acceleration
- Painting graphics using Android’s
- Writing a super simple “game loop” that updates physics in a background thread safely