Android Bouncing Ball Demo
March 21st, 2009
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.
Android Bouncing Ball on G1 from Eric Burke on Vimeo.
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
SurfaceView - Writing a super simple “game loop” that updates physics in a background thread safely
Hey I just wanted to say thank you very much for sharing these examples. The android documentation is spotty at best so this was a huge help. Many thanks man, many thanks.