WHERE AM I SUPPOSED TO POST QUESTIONS LIKE THESE??? <—so I know in the future
Unless I add event.yGravity the xGravity doesn’t work. But I don’t want the yGravity to be used when tilting. Think of it like I’d want to move like Doodle Jump.
Sorry, couldn’t get the code to enter in message with number lines so I just sent plain text
display.setStatusBar( display.HiddenStatusBar )
local physics = require “physics”
physics.start()
local player = display.newImage( “player.png” )
player.x = 160
player.y = 230
player.myName = “player”
physics.addBody( player, { friction=0.3, bounce = 5.0, density = 1.0, radius = 35 } )
player.isFixedRotation = true
system.setAccelerometerInterval( 100 ) – set accelerometer to maximum responsiveness
local ground = display.newImage( “ground.png” )
ground.x, ground.y = 160, 500
function onTilt( event )
physics.setGravity( ( 25 * event.xGravity ) )
end
Runtime:addEventListener( “accelerometer”, onTilt )