Hi
i have a game map which i can move left and right with a finger
is it possible to put in a elastic transition.to effect into the code below somehow
groupmap:insert(map1)
groupmap:insert(boat1)
groupmap:insert(boat2)
– touch listener function
function groupmap:touch( event )
if event.phase == “began” then
self.markX = self.x – store x location of object
self.markY = self.y – store y location of object
--myObject:toBack()
elseif event.phase == “moved” then
local x = (event.x - event.xStart) + self.markX
local y = (event.y - event.yStart) + self.markY
self.x = x ---- move object based on calculations above
--if self.x < 0 then
--self.x=0
--end
if self.x < -500 then
self.x= -500
end
if self.x > 300 then
self.x= 300
end
--boat1:toFront()
--myObject:toBack()
end
return true
end
groupmap:addEventListener( “touch”, groupmap )