This native application uses the accelerometer to determine the direction of gravity for the Box2D physics engine. It performs quite well given the number of computations and could probably be optimized considerably. Check out the video for a demo on the phone!

Porting the code was the easy part. Configuring Adobe Flash and setting up the Android SDK was a bit more work. Check out Lee Brimelow’s awesome tutorial on http://www.gotoandlearn.com/. If you run into problems finding your device with the adb devices command than check out my previous post. We are going to see some pretty exciting stuff around the corner with Adobe AIR for mobile devices!

Full source code can be found here. You’ll need to run through Lee Brimelow’s tutorial to configure Flash before you get started.

8 thoughts on “Box2D on the Nexus One with Adobe AIR

  1. The app from the video is 144KB. The Box2D SWC for Flash is 165KB. I’m going to work on optimizing the performance of the app but file size is looking pretty good. Do you know if there are any good comparable Android 2D engines?

  2. What kind of framerates are we talking here? Have you tried running stock box2d testbed on android and comapring that to a pc in terms of fps?

  3. In the demo it runs at an average of 20fps. With two cubes it runs at 30fps but adding 3+ drops it down to 20fps. You can add up to 10 cubes before the frame rate will dip below 20fps. Static boundaries don’t seem to have an effect on the frame rate so a maze game where one object is moving and the rest are static would work well. Porting a game over from a PC version won’t perform as well. For comparison my PC can handle about 100 objects before dropping down to 20fps.

  4. Ouch, that is pretty terrible. I was really looking forward to doing some games with Flash box2d port for android, but 20fps with such a simple example means a “no go”.

    Thanks for the reply.

Comments are closed.