So I am new to Corona and I was wondering how to make a ball (which at first is not moving at all) go towards the direction of a touch event and never stopping while maintaining its speed and able to bounce off other objects.
Can do this with the physics library?
Here is my code for the ball:
ball = display.newCircle( display.contentWidth / 2, display.contentHeight / 2, 20 )
ball.strokeWidth = 2
ball:setStrokeColor( 0, 0, 0 )
physics.addBody(ball, “dynamic”, {friction=0, bounce = 1, radius=20})
local function shoot(event)
if(event.phase == “ended”) then
--this is where I need help
end
end
Runtime:addEventListener(“touch”, shoot)
(there is more code, obviosly, but it isn’t relevant for this post)