how to rotate player if get effect by gravity

I have problem to make player rotate when affected by gravity ,

my Gravity code is

local motionx = 0

local function onAccelerate( event )
motionx = 20 * event.yGravity
-- player:play()
end

local function moveplayer (event)
player.y = player.y - motionx

end

Runtime:addEventListener ("accelerometer", onAccelerate)

I'm not sure if I understand correctly. Are you wanting the player to rotate or not rotate? If you want the player to rotate then just update the player.rotation with an eventListener (such as your onAccelerate function). If you don't want the player to rotate just use player.isFixedRotation = true

I want my player rotate ,

my problem when I make him rotate when it affect by gravity ,

for example , when my player affected by gravity , rotate (30) .

the problem when my player affected by gravity my player rotate 30 then 30 ( that mean 60 )

and keep going , as result my player rotate around himself .

I want to make him ,

when my player go down , his rotation will be 30

when my player go up , his rotation will be -30

when my player is not effected by gravity ( no change )

that mean when he go up ( player:rotate (30) ) but when he go back ( no up , no down ) his real image show . etc

how do I do that ?

Best Regards,

views:1419 update:2011/10/5 21:23:48
corona forums © 2003-2011