Hello!
I am getting something i don’t understand?
if i have two buttons over each other on big and on smaller ontop of the big one, i got a function that checks for a certain button but when i am clicking on the little on who is onto of the big one, the big one also is pressed. How come?
here is an example:
[lua]function ufoMovement(event)
if(event.target.name == “up” and crashed == false) then
if(event.phase == “began”) then
tmrUp = timer.performWithDelay(150, engines, 0)
elseif(event.phase == “ended”) then
timer.cancel(tmrUp)
spriteInstance.linearDamping = 0
end
end
if(event.target.name == “left” and crashed == false) then
if(event.phase == “began”) then
tmrLeft = timer.performWithDelay(200, sideleft, 0)
elseif(event.phase == “ended”) then
timer.cancel(tmrLeft)
end
end
end
buttonUp:addEventListener(“touch”, ufoMovement)
buttonLeft:addEventListener(“touch”, ufoMovement)[/lua]
i have named the buttons with .name like buttonUp.name = “up”
I think i should be able to hit one button and not let the one under it get pressed?
Kind regards
Inkoqnito [import]uid: 90942 topic_id: 16792 reply_id: 316792[/import]
[import]uid: 3826 topic_id: 16792 reply_id: 62856[/import]