How to move a object in 4 direction using accelerometer in corona sdk?
<p>Here is my code i am trying to move the PLAYER according to accelerometer direction(in 4 direction up,down,left and right) but the ball just moves in 2 direction.
Anyone know the reason for that? Thanks in advance!</p>

<pre><code>  display.setStatusBar(display.HiddenStatusBar)
  system.setAccelerometerInterval( 50 )

  _W = display.contentWidth
  _H = display.contentHeight

  local bg = display.newImage("bg.png")
  bg:setReferencePoint(display.CenterReferencePoint)
  bg.x = _W/2
  bg.y = _H/2

  local player = display.newImage("ball.png")
  player:setReferencePoint(display.CenterReferencePoint)
  player.x = _W/2
  player.y = _H/2

 -- Set up the Accelerometer values in Landscape

 local motionX = 0
 local motionY = 0
 local motionZ = 0                 

 local function onAccelerate( event )
 motionX = 10 * event.yGravity;
 motionY = 10 * event.xGravity;
end

 Runtime:addEventListener ("accelerometer", onAccelerate);

 -- Make the player move on tilt.

local function movePlayer (event)
player.x = player.x + motionX;
player.y = player.y + motionY;
end

Runtime:addEventListener("enterFrame", movePlayer)

local function screenBoundaries (event)

    -- Left side boundaries
if player.x &lt; 0 + player.width/2 then 
   player.x = 0 + player.width/2
end

    -- Right side boundaries
if player.x &gt; display.contentWidth - player.width/2 then
   player.x = display.contentWidth - player.width/2
end

    -- Upper boundaries
if player.y &lt; 0 + player.height/2 then 
   player.y = 0 + player.height/2
end

    -- Lower boundaries
if player.y &gt; display.contentHeight - player.height/2 then 
   player.y = display.contentHeight - player.height/2
end
end

 Runtime:addEventListener("enterFrame", screenBoundaries)
</code></pre>
