Friday, January 14, 2011

A Dice Rolling App Using The Accelerometer Sensor Component of App Inventor

I wrote a dice rolling app using the Accelerometer Sensor component of Google App Inventor, the UI based mobile app creation tool from Google.

This is what the app does. When you shake the phone, the phone vibrates and starts rolling a die. When the vibration stops, the die stops rolling and you get a result from 1 to 6. The result depends on a random number generator and the duration of the shake. So you get an unpredictable result as you would in the real world. Here is the code for the app.

This is a simple app to understand the basic functionality of the Accelerometer component in a phone.

The User Interface
What I like about this app is that it has no buttons on screen. The only way to interact with the app is by shaking the phone. I can imaging a two year old child shaking the phone, feeling the phone vibrate, seeing the dice roll and having a lot of fun with the app. Of course, the Android phone will be a $150 toy.



Related Posts Plugin for WordPress, Blogger...