After seeing tutorials on making a side sliding panel, I decided it would be best to just make my own since I had ideas of how I wanted it customized, my problem now is, I’m having a hard time making the panel move with the user’s finger. On Android phones, a user can slide the sliding panel and it follows the user’s finger within certain limits, that’s what I’m trying to create.
Here’s the code I’ve come up with so far:
function slideTouch (event) if event.phase == "moved" then dist = ( event.x - event.xStart ) --distance finger has slided object.x = object.x + dist --move object by that distance return true end
The reason I did it like this rather than
object.x = event.x
Was because I want it to look like the panel is being moved from the point of contact, rather than being moved by the center but my code doesn’t work right. Sliding just the tiniest bit causes the panel to slide a large distance.
I’d really like some help wit this, thank you!