Hi all, I’m ending a pong game, but I have a problem with the control system. The game area is divide for the two players. Each area have a separate listener for the swipe. If I swipe on these area not at the same time, it’s all ok, but when two players play at te same same time the two paddle go crazy. It’s a limitation of corona or the device ?
Thank you for help, but it doesn’t work 
I’ m trying my game on a galaxy tab2 10.1, a samsung galaxy s2 i9100 and a samsung galaxy s4.
Here some code.
[lua]
----------listeners---------------------
system.activate( “multitouch” )
local swp=function(event) SwipeControlModule.swipe(event,player1) end
tapSx1P:addEventListener( “touch”, swp )
local swp2=function(event) SwipeControlModule.swipe(event,player2) end
tapSx2P:addEventListener( “touch”, swp2 )
------------------------swipe function--------------
local function swipe(event,paddle)
if event.phase==“began” then
--xStart=event.xStart
--yStart=event.yStart
yBack=event.y
--print(“start”)
elseif event.phase==“moved” then
if event.y<yBack then
yBack=event.y+0.01–0.5
if paddle.y-shiftPaddle>=25 then
paddle.y=paddle.y-shiftPaddle
else
paddle.y=25
end
else
yBack=event.y-0.01
if paddle.y+shiftPaddle<=Y-25 then
paddle.y=paddle.y+shiftPaddle
else
paddle.y=Y-25
end
end
elseif event.phase==“ended” then
--//ma li utilizzo sti flag?//–
--paddle.swipeUp=0
--paddle.swipeDn=0
end
[/lua]
Problem solved. I have modified a function in Corona Samples MultiTouch, and all work now. I don’t yet understand all of this function, I’m studying it.
How Could I modify this function to set two limiters (y=0; y=display.contentHeight) for the paddle ?
[lua]
system.activate( “multitouch” )
local function onTouch( event )
local t = event.target
local phase = event.phase
if “began” == phase then
local parent = t.parent
parent:insert( t )
display.getCurrentStage():setFocus( t, event.id )
t.isFocus = true
t.y0 = event.y - t.y
elseif t.isFocus then
if “moved” == phase then
t.y = event.y - t.y0
elseif “ended” == phase or “cancelled” == phase then
display.getCurrentStage():setFocus( t, nil )
t.isFocus = false
end
end
end
local function swipe( event,paddle )
local s = display.getCurrentStage()
if “began” == event.phase then
paddle.y0 = event.y - paddle.y
paddle.isFocus = true – **tbr - remove later
touchPaddle = paddle – **tbr - temp
paddle.id = event.id – save our id so we can access the object later
paddle:addEventListener( “touch”, onTouch )
event.target = paddle
onTouch( event )
end
end
[/lua]
Resolved ! Thanks for Help ! =)
[lua]
…
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
if (event.y - t.y0)-25 > 0 and (event.y - t.y0)+25 < Y then
t.y = event.y - t.y0
end
…
[/lua]
Thank you for help, but it doesn’t work 
I’ m trying my game on a galaxy tab2 10.1, a samsung galaxy s2 i9100 and a samsung galaxy s4.
Here some code.
[lua]
----------listeners---------------------
system.activate( “multitouch” )
local swp=function(event) SwipeControlModule.swipe(event,player1) end
tapSx1P:addEventListener( “touch”, swp )
local swp2=function(event) SwipeControlModule.swipe(event,player2) end
tapSx2P:addEventListener( “touch”, swp2 )
------------------------swipe function--------------
local function swipe(event,paddle)
if event.phase==“began” then
--xStart=event.xStart
--yStart=event.yStart
yBack=event.y
--print(“start”)
elseif event.phase==“moved” then
if event.y<yBack then
yBack=event.y+0.01–0.5
if paddle.y-shiftPaddle>=25 then
paddle.y=paddle.y-shiftPaddle
else
paddle.y=25
end
else
yBack=event.y-0.01
if paddle.y+shiftPaddle<=Y-25 then
paddle.y=paddle.y+shiftPaddle
else
paddle.y=Y-25
end
end
elseif event.phase==“ended” then
--//ma li utilizzo sti flag?//–
--paddle.swipeUp=0
--paddle.swipeDn=0
end
[/lua]
Problem solved. I have modified a function in Corona Samples MultiTouch, and all work now. I don’t yet understand all of this function, I’m studying it.
How Could I modify this function to set two limiters (y=0; y=display.contentHeight) for the paddle ?
[lua]
system.activate( “multitouch” )
local function onTouch( event )
local t = event.target
local phase = event.phase
if “began” == phase then
local parent = t.parent
parent:insert( t )
display.getCurrentStage():setFocus( t, event.id )
t.isFocus = true
t.y0 = event.y - t.y
elseif t.isFocus then
if “moved” == phase then
t.y = event.y - t.y0
elseif “ended” == phase or “cancelled” == phase then
display.getCurrentStage():setFocus( t, nil )
t.isFocus = false
end
end
end
local function swipe( event,paddle )
local s = display.getCurrentStage()
if “began” == event.phase then
paddle.y0 = event.y - paddle.y
paddle.isFocus = true – **tbr - remove later
touchPaddle = paddle – **tbr - temp
paddle.id = event.id – save our id so we can access the object later
paddle:addEventListener( “touch”, onTouch )
event.target = paddle
onTouch( event )
end
end
[/lua]
Resolved ! Thanks for Help ! =)
[lua]
…
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
if (event.y - t.y0)-25 > 0 and (event.y - t.y0)+25 < Y then
t.y = event.y - t.y0
end
…
[/lua]