I have this basic code entered (with physics engine on, etc.) –
–Add a ball
local ball = display.newImage(“coconut.png”)
ball.x = 155
ball.y = 200
ball.xScale = 2.3
ball.yScale = 2.3
ball:setReferencePoint( display.CenterReferencePoint )
physics.addBody( ball, {friction=0.5, bounce=0.5, radius=45} )
–Add Event Listener and allow for interactivity
function moveBall(event)
local vx = (ball.x-event.x)/100
local vy=-5.0
ball:applyLinearImpulse( vx, vy, event.x, event.y )
end
ball:addEventListener(“touch”, moveBall)
The ball reacts how I would like, but it spins at an increasingly fast rate and it looks very unprofessional. How do I fix this? [import]uid: 39628 topic_id: 7557 reply_id: 307557[/import]
