Mouse click input going through scenes

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By tjdwlgns612

Hey all,

First time creating a menu for my game and made a simple signal so that clicking the “start” button takes me to the main scene:

func _on_Start_pressed():
get_tree().change_scene("res://Main.tscn") # Change to main scene

That works fine, but in my main scene I have a code where if I click somewhere, it shoots a ball:

if canShoot and Input.is_action_just_released("click"):
	_shoot_ball(delta)

The problem is, when I start my game and press “start” with my mouse button, it also activates the input inside the main scene and not just my menu scene. Would appreciate any help!

:bust_in_silhouette: Reply From: Noddy

I think changing the condition from is_action_just_released to is_action_just_pressed might fix your conundrum. However, if that is not viable for whatever reason you could add a caveat to canShoot by adding a timer that starts in the ready function and a function that catches the timeout signal from the timer which then enables or adds to the condition that makes canShoot true. Best of luck.