I have a code wich display object (crosshair) at the point where the user taps.
- If crosshair doesn’t exist, It creates it and starts the countdown (1 sec) to remove
- If crosshair already exist, It changes coordinates and set timer ._delay countdown back to 1 sec
I tested this code and see, that ._delay reset sometimes doesn’t just work - coordinates changed but crosshair exist less than 1 sec.
Did I smth wrong?
local tapAreaFlag=false local tapArea local tapAreaTimer local function tap ( event ) local CoordXtap, CoordYtap = event.x, event.y if tapAreaFlag== false then tapArea= display.newCircle( mainGroup, CoordXtap,CoordYtap, 50) tapArea.fill = { type = "image", sheet = uiFrames, frame = 8 } tapAreaTimer=timer.performWithDelay (1000, function () tapAreaFlag = false display.remove( tapArea ) end ) tapAreaFlag = true elseif tapAreaFlag == true then tapArea.x, tapArea.y = CoordXtap, CoordYtap tapAreaTimer.\_delay=1000 end end