The accelerometer is easy to get working with pgs4a.
To pull the x,y,z axis, use this:
You will get a floating point number for each of the three axises.
Here's a simple way to set four directions, up, down, left, right:
In the example above, I'm holding the phone sideways, in landscape mode. The left-right movement is controlled by the 2nd value in the list and the up-down movement is controlled by the 1st item in the list.
It would easy to set up 8 direction movement or even a greater range of movement. Unlike Swarm, which used only 8 directions for bullets, we're using sin and cos to give the bullets a greater range of movement.
In order to test the application on my desktop, I've also created a virtual controller to simulate the accelerometer.
Here's the application running on my desktop with the virtual controller.
I/python (21058): Initialize Python for Android I/python (21058): ['/data/data/org.pychildren.accel/files/lib/python2.7/site-packages', '/data/data/org.pychildren.accel/files/lib/site-python'] I/python (21058): Opening APK '/data/app/org.pychildren.accel-1.apk' I/python (21058): (-3.8019924163818359, -0.31603461503982544, 8.7819318771362305) I/python (21058): (-3.8019924163818359, -0.31603461503982544, 8.7819318771362305) I/python (21058): (-3.8019924163818359, -0.31603461503982544, 8.7819318771362305)
If you don't know how to see the output from your app when it is running on your phone, read my post explaining how you can see the output of your print statements with adb.
Here's a demo of the character running on an old Samsung phone without the flock. The controller in the lower right is for 360 degree bullet firing.