0 votes

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!

in Engine by (27 points)

1 Answer

+1 vote
Best answer

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.

by (144 points)
selected by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.