Hi, I am relatively new to corona so bear with me and apologies if this is in the wrong forum. I’m ultimately trying to setup a drag & drop function for multiple ‘tiles’ on one scene. But to begin with (and to make sure I understand all of this correctly) I am just trying to get one tile moving around the screen.
So I browsed the interwebs for a while and found the solution below (among other similar solutions) and implemented this myself with my own object names etc.
It works great…but…unfortunately when I drag the object into the top right quadrant of the screen (on the simulator and a phone) the object gets stuck. It stops dragging as it hits any part of the top right quadrant of the screen, and I cannot re-select it to drag it back to the rest of the screen.
Any ideas as to why this is happening?? (my code is below)
local _H = display.contentHeight
local _W = display.contentWidth
local notesGroup = display.newGroup()
local tile1 = display.newImage (“graphics/image.PNG”)
tile1.x = _W/2
tile1.y = _H/2
function tile1: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
elseif event.phase == “moved” then
local x = (event.x - event.xStart) + self.markX
local y = (event.y - event.yStart) + self.markY
self.x, self.y = x, y
end
return true
end
notesGroup:insert(tile1)
tile1:addEventListener(“touch”, tile1)
return notesGroup