Clicking buttons without performing other actions in game

Hello, I am not sure i put my issue to work very well in the title so i’ll try to explain.
I am making a prototype of a zigzag clicking game for android mobiles, when you click the little ball turns right or left allowing you to follow a random path. I just now implemented a pause button that seems to be working ok. But the problem is that when i press the button the game registers as a click in the screen and changes the ball’s direction.
Is there a way to disregard the click when it is in a certain area or on top of a button?
As a makeshift solution i though of inserting a change of direction inside the pause function, but it seems so … not good enough…

For now i solved the problem restricting the command to switch direction to another button covering most of the screen but not the area where the other buttons are.

How about, making a boolean variable that is false when you are on the menu, and true when not on the menu. Whenever you click, it will check if the variable is true, if so, it will execute the change of direction,
if not, it will not change the direction.