Try something like this to get you started.
local centerX = display.contentCenterX local centerY = display.contentCenterY local \_W = display.contentWidth local \_H = display.contentHeight local physics = require("physics") physics.setDrawMode("hybrid") physics.start() physics.setScale( 60 ) physics.setGravity( 0, 0 ) system.setAccelerometerInterval( 100 ) -- set accelerometer to maximum responsiveness display.setStatusBar( display.HiddenStatusBar ) function onTilt( event ) physics.setGravity( ( -7 \* event.yGravity ), ( -7 \* event.xGravity ) ) end Runtime:addEventListener( "accelerometer", onTilt ) local borderBodyElement = { friction= 0.3, bounce = .5 } local borderTop = display.newRect( 0, 0, \_W,30 ) borderTop.anchorX = 0 borderTop:setFillColor( 0, 0, 0, 0) physics.addBody( borderTop, "static", borderBodyElement ) local borderBottom = display.newRect( 0, \_H , \_W, 30) borderBottom.anchorX = 0 borderBottom:setFillColor( 0, 0, 0, 0) physics.addBody( borderBottom, "static", borderBodyElement ) local borderLeft = display.newRect( 0, 0, 30, \_H ) borderLeft.anchorY = 0 borderLeft:setFillColor( 0, 0, 0, 0) physics.addBody( borderLeft, "static", borderBodyElement ) local borderRight = display.newRect( \_W , 0, 30, \_H ) borderRight.anchorY = 0 borderRight:setFillColor( 0, 0, 0, 0) physics.addBody( borderRight, "static", borderBodyElement ) local ball = display.newImage("Icon-60.png", 60, 60 ) physics.addBody( ball, { radius = 30 } ) ball.isSleepingAllowed = false ball.x = \_W / 2 ball.y = \_H / 2