In my game i have to control handstand man using accelerometer. i used this code:
function acc:accelerometer(e)
if(e.yGravity > 0.1 and e.yGravity < 0.2)then
boy:applyLinearImpulse(0.1, .5, boy.x, boy.y)
elseif(e.yGravity > 0.2 and e.yGravity < 0.3)then
boy:applyLinearImpulse(0.2, .5, boy.x, boy.y)
elseif(e.yGravity > 0.3 and e.yGravity < 0.4)then
boy:applyLinearImpulse(0.3, .5, boy.x, boy.y)
elseif(e.yGravity > 0.4 and e.yGravity < 0.5)then
boy:applyLinearImpulse(0.4, .5, boy.x, boy.y)
elseif(e.yGravity > 0.5 and e.yGravity < 0.9)then
boy:applyLinearImpulse(0.5, .5, boy.x, boy.y)
elseif(e.yGravity > -0.1 and e.yGravity < 0.1)then
boy:applyLinearImpulse(-0.1, .5, boy.x, boy.y)
elseif(e.yGravity > -0.2 and e.yGravity < -0.1)then
boy:applyLinearImpulse(-0.2, .5, boy.x, boy.y)
elseif(e.yGravity > -0.3 and e.yGravity < -0.2)then
boy:applyLinearImpulse(-0.3, .5, boy.x, boy.y)
elseif(e.yGravity > -0.4 and e.yGravity < -0.3)then
boy:applyLinearImpulse(-0.4, .5, boy.x, boy.y)
elseif(e.yGravity > -0.5 and e.yGravity < -0.4)then
boy:applyLinearImpulse(-0.5, .5, boy.x, boy.y)
elseif(e.yGravity > -0.9 and e.yGravity < -0.5)then
boy:applyLinearImpulse(-0.6, .5, boy.x, boy.y)
end
please help me how to code.