So here is my issue,
I have a object that uses the accelerometer to move only left and right. On the orientation “landscapeRight” my object works perfectly, I tilt left the object moves right, just like it supposed to. On the orientation “landscapeLeft” things dont work right. I tilt left the object moves left, right moves it moves right. Can someone help me fix this? It feels unnatural for it to move the direction opposite I am tilting, plus it is inconsistent with the other orientation.
Here is my current code:
[lua]maxVisibleX = display.viewableContentWidth + -1* display.screenOriginX
local motionx = 0
local function onTilt( event )
motionx = (30 * event.yGravity) – Uses y gravity because it is in landscape orientation
end
Runtime:addEventListener( “accelerometer”, onTilt )
local function moveball (event)
if ((pail.x + motionx) < maxVisibleX) then
if ((pail.x + motionx) > display.screenOriginX) then
pail.x = pail.x + motionx + (motionx/2)
end
end
end
Runtime:addEventListener(“enterFrame”, moveball)[/lua] [import]uid: 104852 topic_id: 27466 reply_id: 327466[/import]