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]