Reputation: 179
I am creating a game in which you select the levels on a map of a town, like in Granny Smith or Candy Crush. You drag the the map to reveal more levels ( the map being a group with level pictures and a background in it). I used the drag function from the sample project. It works perfectly, but it is not smooth at all. When the map is released after being dragged,I want it to continue in that direction, and slow down and stop instead of stopping as soon as the map is released. Any thoughts?
Upvotes: 1
Views: 386
Reputation: 1036
I would use something like this:
local target = 100
local tapDrag = function(e) player.y = (player.y*10 + target) / 11 end
Runtime:addEventListener( "touch", function(e) target = e.y end)
Runtime:addEventListener( "enterFrame", tapDrag )
This would make it so the object would be smooth on the Y axis. You could also make this work for the X Axis too. Good luck
Upvotes: 1