Hi Andrew, thanks for your response, here is more of my code below:
local beginX local beginY local endX local endY local xDistance local yDistance function checkSwipeDirection() xDistance = math.abs(endX - beginX) yDistance = math.abs(endY - beginY) if xDistance \> yDistance then if beginX \> endX and ceilingCollisionBoolean == false then transition.to(mover, {time=200, x=(mover.x-80), y=mover.y}) else transition.to(mover, {time=200, x=(mover.x+80), y=mover.y}) end else if beginY \> endY then transition.to(mover, {time=200, x=mover.x, y=(mover.y-80)}) else transition.to(mover, {time=200, x=mover.x, y=(mover.y+80)}) end end end function swipe(event) if event.phase == "began" then beginX = event.x beginY = event.y end if event.phase == "ended" then endX = event.x endY = event.y checkSwipeDirection() end end Runtime:addEventListener("touch", swipe) local ceilingCollisionBoolean local function moverCollision(event) if (event.phase == "began") then if event.object1.name == "ceiling" and event.object2.name == "mover" then ceilingCollisionBoolean = true print("collision occurred") elseif event.object1.name == "mover" and event.object2.name == "ceiling" then ceilingCollisionBoolean = true print("collision occurred") else ceilingCollisionBoolean = false end end end Runtime:addEventListener ("collision", moverCollision)
Please let me know if you have any thoughts thanks!