2 objects getting clicked at same time

I’m trying to have a pause button in my game, but I also have a click event on the background of the screen. When I click on the pause button both the background click and the pause click gets called. Is there a way to only call the pause click?

In the Pause button’s click function put “return true” at the end

I just tried that and it didn’t work. I’m assuming that’s to consume the click even and prevent it from bubbling up?

okay fixed it the pause button was using a “tap” event and the background was using a “touch” event. It appears that the touch event gets called before the tap. I’m assuming this is because the tap registers only on event ended and not started like the touch.

Can you post your code?

In the Pause button’s click function put “return true” at the end

I just tried that and it didn’t work. I’m assuming that’s to consume the click even and prevent it from bubbling up?

okay fixed it the pause button was using a “tap” event and the background was using a “touch” event. It appears that the touch event gets called before the tap. I’m assuming this is because the tap registers only on event ended and not started like the touch.

Can you post your code?