I have a dynamic physics object in a gravityless (not sure if that’s a word) environment in my project.
Here’s my code:
[lua]
local mask = display.newImageRect(“transparentmask.png”, 320, 568)
local ball = display.newImage(“ball.png”)
local check = function(event)
boostxf = event.xStart - event.x
boostyf = event.yStart - event.y
boostx = boostxf/-200
boosty = boostyf/-200
ball:applyLinearImpulse( boostx, boosty, ball.x, ball.y )
end
mask:addEventListener(“touch”, check)
[/lua]
I had made a function that applies linear impulses on the ball based on swipe movements. It works, but I would also like to make the ball stop completely when the user taps the screen, but I don’t know how to do this.
Any help or tips are appreciated