Multitouch problems with Galaxy Tab [FIXED]

I’m having a problem with Multitouch on Android(iOS could have the same problem).

I’ll use a Multi-player pong game as an example.

If I touch and hold the RIGHT paddle and then touch and hold the LEFT paddle they both
move o.k., and if I lift the LEFT paddle, the RIGHT paddle still moves o.k.

Now here the problem. While holding down both paddles(right being the first), if I lift
the RIGHT paddle, the LEFT paddle also stops moving, but if I touch the RIGHT paddle again,
you can also move the LEFT paddle again.

I know, confusing. The best way to test is load a pong game, Air hockey, or any Multitouch
sample that comes with Corona, they will all do the same thing.

There is probably an easy way to fix this, but I’m having trouble. So I’d appreciate any help.

Thank you.

Here is a quick example, but any multitouch Corona example will have the same problem.

system.activate("multitouch")  
  
function onTouch(event)  
  
 if not (event.target.name == "leftPaddle" or event.target.name == "rightPaddle") then  
 return false  
 end  
  
 if event.phase == "moved" then  
 -- Move right paddle  
 if event.target.name == "rightPaddle" then  
 rightPaddle.y = event.y  
 end  
  
 -- Move left paddle  
 if event.target.name == "leftPaddle" then  
 leftPaddle.y = event.y  
 end  
 end  
end  
  
leftPaddle:removeEventListener("touch", onTouch)  
rightPaddle:removeEventListener("touch", onTouch)  

[import]uid: 53445 topic_id: 12831 reply_id: 312831[/import]

I haven’t tried this yet, but you may want to check out:

http://developer.anscamobile.com/reference/index/events/touch/eventid

You get a unique ID for each finger. So, when a paddle is touched, you want to get event.id and store it in a variable called leftpaddlefinger or something… so that you know for future touches this refers to the left paddle. Then on the “ended” phase you clear out the variable.

I don’t like your constant string evaluations with event.target.name … that looks like it will get you into trouble.

Hope I have been of help. [import]uid: 70391 topic_id: 12831 reply_id: 47097[/import]

I tried using event.id, but still could not get it working.

I’m coming from GLBasic SDK. So I’m use to using touch inputs as shown below.
I have the Corona Multi-touch working o.k, it’s just that I don’t like how
it stops the second touch if the first touch is lifted. That would be bad
for the second player playing pong or air hockey.

I’ll keep trying.

Thanks.

[code]
// Touch Type
TYPE tTouch
x%
y%
touched%
ENDTYPE

// Array to hold touch
GLOBAL touch[] AS tTouch
DIM touch[2]

FUNCTION onTouch:
local touches = 2
FOR imouse% = 0 TO touches
SETACTIVEMOUSE imouse%
MOUSESTATE mx%, my%, b1%, b2%
touch[imouse].x=mx
touch[imouse].y=my
touch[imouse].touched=b1
NEXT
ENDFUNCTION
[/code] [import]uid: 53445 topic_id: 12831 reply_id: 47189[/import]

Well, I tried everything I can think of and still can’t get it to work right.

Could it be that it’s not possible to keep the second touch movement going
if the first touch is lifted with Corona?

Maybe Team Corona can chime in. [import]uid: 53445 topic_id: 12831 reply_id: 47231[/import]

Fixed with the latest version CoronaSDK 2011.591.

The device I was testing on was a Galaxy Tab.

Thank you. [import]uid: 53445 topic_id: 12831 reply_id: 48407[/import]