NOTE This code is in a function that is a listener for display object: “playerPiece”. It’s is called when playerPiece gets an onTouch event when event.phase == “ended”
Line 1 just snaps the display object back to it’s original position after it was moved.
But the actual SNAP BACK doesn’t occur until after the pause code has finished executing. What the heck is going on?
playerPiece.x=playerPiece.orgX; playerPiece.y=playerPiece.orgY
-- Pause a little while
local t1 = os.clock()
local t2 = t1
while os.difftime(t2, t1) \< 10 do -- pause before swapping player
t2 = os.clock()
end
[import]uid: 295 topic_id: 1499 reply_id: 301499[/import]
[import]uid: 6928 topic_id: 1499 reply_id: 4239[/import]