Hello everyone.
I want to move object A and only object A, but when center of this object coincide with center of object B then I can move two obj. and I can’t separate objects. All code that I use:
CenterY=display.contentCenterY CenterX=display.contentCenterX W=display.contentWidth H=display.contentHeight local background=display.newImageRect("Images/background.png",720,1280) background.x=CenterX background.y=CenterY local base=display.newImageRect("Images/2.png",50,50) base.x=CenterX+100 base.y=CenterY+250 local roof=display.newImageRect("Images/1.png",50,50) roof.x=CenterX-50 roof.y=CenterY-125 function base:touch(b) if b.phase=="began" then print("Touch base status: true.") elseif b.phase=="moved" then base.x=b.x;base.y=b.y; elseif b.phase=="ended" then print("Touch base status: false") end end function roof:touch(r) if r.phase=="began" then print("Touch roof status: true.") elseif r.phase=="moved" then roof.x=r.x;roof.y=r.y; elseif r.phase=="ended" then print("Touch roof status: false.") end end base:addEventListener("touch",move) roof:addEventListener("touch",move)