Heya, I am currently trying the 30 day trial, and I want to focus on Android development. I’m having a friend of mine test out my code on a actual Motorola Droid until I get one of my own, so I wanted to test out basic functionality I wanted to use in the future. So I cooked up this code:
[code]local function onAccelerate( event )
MyObject.x = display.contentWidth / 2 + event.xGravity
MyObject.y = display.contentHeight / 2 + event.yGravity
if event.isShake then
MyObject.x = display.contentWidth / 3
MyObject.y = display.contentHeight / 2
end
if MyObject.x < 0 then
MyObject.x = 0
elseif MyObject.x > display.contentWidth then
MyObject.x = display.contentWidth
end
if MyObject.y < 0 then
MyObject.y = 0
elseif MyObject.y > display.contentHeight then
MyObject.y = display.contentHeight
end
end
Runtime:addEventListener (“accelerometer”, onAccelerate);[/code]
When I shake it in the simulator, it moved to the left so I assumed all of it would work on an actual Android… no dice.
Confused, I copy and pasted the code from the multi-touch iPhone example and test that. And that didn’t work either! He could only move one box at a time.
The accelerometer is the bigger one of the two, but I read a earlier post that the accelerometer has been working on the Android sense the beginning! What am I doing wrong? He also says that the .apk installer doesn’t ask to use the accelerometer like he expected, do I need to put that in build.settings somehow?
Thanks for any input. But frankly if I can’t find out how to do this properly I will be forced to look elsewhere for another SDK. [import]uid: 8326 topic_id: 1741 reply_id: 301741[/import]