The radius is 50 and after the ball is finished bouncing, it hovers over the rectangle. Also how can I make it follow my finger tap ?
local composer = require( "composer" ) local scene = composer.newScene() local physics = require("physics") physics.start() local background local myRectangle local ball local finish function scene:create (event) local screenGroup = self.view background = display.newImageRect("backg.jpg", display.contentWidth,display.contentHeight) background.x = display.contentCenterX background.y = display.contentCenterY screenGroup:insert(background) myRectangle = display.newRect( 50, 300, 40, 20 ) myRectangle:setFillColor( 0.5 ) ball = display.newImage("balll.png") ball.x = 50 ball.y = 60 ball:scale( 1.5, 1.5 ) ball.alpha = 0.8 screenGroup:insert(ball) finish = display.newImage("finish.png") finish.x = 150 finish.y = 300 screenGroup:insert(finish) physics.addBody( myRectangle, "static" ) physics.addBody( ball, "dynamic", { radius=50, density=1, bounce=0.3 } ) local function pushBall() ball:applyLinearImpulse( 0, -0.75, ball.x, ball.y ) end ball:addEventListener( "tap", pushBall) end function scene:show(event) local sceneGroup = self.view local phase = event.phase if ( phase == "will" ) then print("show started") elseif ( phase == "did" ) then print("show showing objects") end end function scene:hide(event) local sceneGroup = self.view local phase = event.phase if ( phase == "will" ) then print("hide started") elseif ( phase == "did" ) then print("hide removing objects") end end function scene:destroy(event) end scene:addEventListener("create", scene) scene:addEventListener("show", scene) scene:addEventListener("hide", scene) scene:addEventListener("destroy", scene) return scene