I’ve ran into a problem where the “moved” event fires multiple times without the “began” event firing before it. This leave my game in an inconsistent state and pretty much renders it useless.
The problem happens when you tap and drag very fast (which my app requires). I’ve created a demo with the minimum code necessary to reproduce this behavior. The square should tilt when you tap or drag it. Note: in this demo the square’s position has been fixed to make the issue more obvious but this “bug” happens weter the square moves or not.
https://www.youtube.com/watch?v=e1aiIAkRzbg
It’s very hard reproduce do with the mouse but it’s quite easy to do in the actual device. I finally get it around second 14 in the video.
Any help will be greatly appreciated!
local button = display.newRect(display.contentCenterX, display.contentCenterY, 300, 300) local touchHandler = function(event) if event.phase == "began" then display.getCurrentStage():setFocus(button) button.rotation = 45 print(event.phase .. "------------------\\") end if event.phase == "ended" or event.phase == "cancelled" then display.getCurrentStage():setFocus(nil) button.rotation = 0 print(event.phase .. "------------------/") end if event.phase == "moved" then button.rotation = 45 print(event.phase) end return true end button:addEventListener("touch", touchHandler)