Discord
Login
Community
DARK THEME

Please help me with this.

How to tap a sprite using the touch object

It is prettysimple!

if touch.press then
    dx = mouse.x - sprite.x
    dy = mouse.y - sprite.y
    distance = sqrt(dx^2 + dy^2)

    if distance < 20 then // change 20 to whatever distance you like
        print("Pressed!")
    end
end

Thank you very much, you are the best!

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community