Hello…
I remember Brent help me on a function to detect if I touch one object
or another. In a “touch” function – event.phase == “began”
and it works great. But when I “ended” the “touch” I asked how to detect
if The – ended touched is coming from the 1st object or the second
and he said that that would get more complicated.
Now I have that problem in my new app, I guess I would understand it now.
I have a table
local noteNames = { "images/bDoOn.png", "images/bReOn.png", "images/bMiOn.png", "images/bDoOff.png", "images/bReOff.png", "images/bMiOff.png" }
Then I have the function that tells me if I touch object 1 , 2 or 3
it works fine on the “began” phase
[code]
function tt( event )
if ( event.phase == “began” ) then
if event.target.number == 1 then
keys[1].isVisible = false
keys[4].isVisible = true
elseif event.target.number == 2 then
keys[2].isVisible = false
keys[5].isVisible = true
elseif event.target.number == 3 then
keys[3].isVisible = false
keys[6].isVisible = true
else
return true
end
elseif ( event.phase == “ended” or event.phase == “cancelled” ) then
keys[4].isVisible = false
keys[1].isVisible = true
spaceship.alpha = 0
end
return true
end
[code]
but as you can see the “ended” phase works fine if I touch “key [1]”
but if I touch “key [2]” or “key[3]” I don’t know how to do it.
The idea is to “know” if I “ended” the phase after having touching object 1 – do this
after having touching object 2 – do that
like that…
Thanks for all your help.
P.S. That’s why I love Corona a lot. and all my apps are with Corona (12 so far)
because you guys help me learn a lot and do what I really love. Thanks
Victor