How to tilt side to side smoothly [Code Included]

So i have this code and it lets me move the object side to side on tilt on the X axis… but its glitchy like it moves but it has a distinctive glitchyness to it… how do i fix it? 

local function onAccelerate( event ) if Player.x \> display.contentWidth \* -0.2 and Player.x \< display.contentWidth \* 1.2 then Player.x = Player.x + (event.xInstant) \* 200 end if Player.x \> display.contentWidth \* 1 then Player.x = display.contentWidth \* 0.97 end if Player.x \< display.contentWidth \* 0 then Player.x = display.contentWidth \* 0.01 end end

Hi @SonicX278,

Did you check out the code for the Corona sample “Accelerometer”? This might give you a better working foundation.

https://github.com/coronalabs/samples-coronasdk/tree/master/Hardware/Accelerometer

Brent

Ok so i looked through the code ad its only confusing me… any other way this could work?

Hi @SonicX278,

Did you check out the code for the Corona sample “Accelerometer”? This might give you a better working foundation.

https://github.com/coronalabs/samples-coronasdk/tree/master/Hardware/Accelerometer

Brent

Ok so i looked through the code ad its only confusing me… any other way this could work?