0 votes

My scene has a button connected with a pressed() signal:

func _on_new_game_pressed():
    emit_signal("new_game")

The game has only this action, that is the mouse click (actually touchscreen because it is a mobile game). The new_game does not change the scene, it just clears the screen and reset the points.

The issue I'm facing is that when new_game runs, it starts firing up the shoot action.

func get_input():
    var m_input = Input.is_action_just_pressed("ui_shoot)
    if m_input:
        shoot()

func _physics_process(delta):
    get_input()

How can I prevent this from happening?

in Engine by (37 points)

1 Answer

0 votes

You could either use a short delay before the game starts and resets. If that's the only button that has the problem, you could also have a variable that is set to false when you click the button and the button function will check the variable to ignore just the first click.

by (654 points)
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 [email protected] with your username.