Let me describe my problem.
My game has two actions, tap the left side of the screen for jump, tap right for rolling.
--what happens on touch
local function touched( event )
--touch on the left, jump
if( event.x \< (\_W/2) ) then
--jumping code here...
end
--touch on the right, dash.
if ( event.x \> (\_W/2) ) then
--rolling code here...
end
end
--screen touch listener
Runtime:addEventListener("touch", touched, -1);
But there is also a pause button, located in the top right corner.
local function pause ()
if \_paused == false then
--stop actions
elseif \_paused == true then
--resume action
end
end
--pause listener
pauseBtn:addEventListener("tap", pause, -1);
My problem is that touching the pause button also activates the “rolling” action (because the button is on the right side of the screen) How can I make it so that doesn’t happen?
I guess I could just make a giant sensor behind the pause button and just listen for that, but would that affect performance? (something I’m really paranoid with).
[import]uid: 136402 topic_id: 29926 reply_id: 329926[/import]