http://i.imgur.com/72UnMe1.jpg
and the following is my code
ps. I just copy the line "appWarpClient.sendUpdatePeers(tostring(t.id) .. " " .. tostring(t.x).." ".. tostring(t.y))"
to moved phase,and it works when I move slowly.
If I move fast,it show error like the picture like that picture
local function onTouch( event )
local t = event.target
local phase = event.phase
if "began" == phase then
-- Make target the top-most object
local parent = t.parent
parent:insert( t )
display.getCurrentStage():setFocus( t )
t.isFocus = true
-- Store initial position
t.x0 = event.x - t.x
t.y0 = event.y - t.y
elseif t.isFocus then
if "moved" == phase then
-- Make object move (we subtract t.x0,t.y0 so that moves are
-- relative to initial grab point, rather than object "snapping").
t.x = event.x - t.x0
t.y = event.y - t.y0
appWarpClient.sendUpdatePeers(tostring(t.id) .. " " .. tostring(t.x).." ".. tostring(t.y))
elseif "ended" == phase or "cancelled" == phase then
display.getCurrentStage():setFocus( nil )
t.isFocus = false
print("moved button id ".. tostring(t.id))
-- send the update to others in the game room. space delimit the values and parse accordingly
-- in onUpdatePeersReceived notification
appWarpClient.sendUpdatePeers(tostring(t.id) .. " " .. tostring(t.x).." ".. tostring(t.y))
end
end
return true
end