I’m new to Corona and Lua and am developing an app involving accelerometer controls, but it’s very tedious to do so because the only way I can test is building the .apk, emailing it to myself, installing it on my phone and then running it. I was wondering if there were tricks to test without doing this?
On that note, I was wondering if this code would work for tilting the phone and making a ball bounce around? I’m new to this so if there are any stupid/nonsensical things, don’t rip me apart please!
[code]
---------- Physics Definition Area ----------
local physics = require( “physics” )
physics.start()
function onTilt(event)
physics.setGravity( ( 10 * event.xGravity), ( -10 * event.yGravity ) )
end
Runtime:addEventListener( “accelerometer”, onTilt)
---------- Variables Area ----------
local _W = display.contentWidth
local _H = display.contentHeight
---------- Objects Area ----------
local ball = display.newImageRect( “images/puck.png”, 112, 112 )
ball.x = _W/2; ball.y = _H/2;
physics.addBody( ball, { density = 2.0, friction = 0.3, bounce = 0.8 } )
[/code] [import]uid: 66386 topic_id: 11781 reply_id: 311781[/import]