In my game, I start the gameplay after clicking the left mouse button:
if event is InputEventMouseButton:
if event.button_index == MOUSE_BUTTON_LEFT and event.pressed:
if game_running == false:
start_game()
But I would like to add a mute button to the main screen. But when you add such a button, when you click on it, the gameplay begins. How can I fix this?
Do you use _input(evt)
or _unhandled_input(evt)
?
Could you use button nodes as children of either a control node or a canvas layer node? You can use signals from the button to detect if it has been pressed. You can also use a shortcut, so the button is pressed if you press a key. See the keyboard shortcut section for more information.
Yes, I was thinking of using this method, but I can’t start the gameplay properly because of this part of the script. I wrote my project based on a tutorial from Youtube(https://youtu.be/9f9t9eiCDAA?si=X1wTH9BxsWV2Bh5q ). I hope this will help in solving my problem.