Dragging Too Fast Loses Object

function touchCircle:touch(event) if "began" == event.phase then self.markx = self.x self.marky = self.y elseif "moved" == event.phase then local tempx = self.markx local tempy = self.marky local x = (event.x - event.xStart) + tempx local y = (event.y - event.yStart) + tempy self.x = x self.y = y elseif "ended" == event.phase then end end

I’m using this code to drag a small circle across the screen, but if I move my finger/mouse too fast, the movement of the circle can’t keep up and the circle stops moving even though my finger is still moving. Is there a different way of doing this so that the circle keep’s up with my finger? 

Hey, So what you have to do is set focus to that object. Like this. --This code is a sample. You can put it into a main.lua and try it out.–

centerX = display.contentCenterX centerY = display.contentCenterY local player = display.newRect( centerX, centerY, 20, 20 ) local function dragBody(event) local playerMoveFocus = event.target local stage = display.getCurrentStage() if event.phase == "began" then stage:setFocus( playerMoveFocus, event.id ) playerMoveFocus.isFocus = true elseif event.phase == "moved" then player.x = event.x player.y = event.y elseif event.phase == "ended" then stage:setFocus(playerMoveFocus, nil) playerMoveFocus.isFocus = false end return true end player:addEventListener( "touch", dragBody )

Good Luck!

–SonicX278

Hey, So what you have to do is set focus to that object. Like this. --This code is a sample. You can put it into a main.lua and try it out.–

centerX = display.contentCenterX centerY = display.contentCenterY local player = display.newRect( centerX, centerY, 20, 20 ) local function dragBody(event) local playerMoveFocus = event.target local stage = display.getCurrentStage() if event.phase == "began" then stage:setFocus( playerMoveFocus, event.id ) playerMoveFocus.isFocus = true elseif event.phase == "moved" then player.x = event.x player.y = event.y elseif event.phase == "ended" then stage:setFocus(playerMoveFocus, nil) playerMoveFocus.isFocus = false end return true end player:addEventListener( "touch", dragBody )

Good Luck!

–SonicX278