Button press won't work

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

Code:

extends Button

func _ready():
    pass

func _process(delta):
    if Input.is_key_pressed(KEY_ESCAPE):
	    get_tree().quit()


func _on_New_Game_pressed():
    print("Pressed")
    get_parent().get_node("AnimationPlayer").play("Fade")
    get_tree().change_scene("res://Scenes/Level1.tscn")

Is the pressed signal connected properly?

stan.wick.52 | 2020-12-11 19:03

What do you mean?

Annoying_Brother | 2020-12-11 19:46

it worked before but now it doesn’t

Annoying_Brother | 2020-12-11 19:49

Presumably, you have a button in the scene that should run the code found in the _on_New_Game_pressed() function, right? To make that happen, you need to connect that button’s pressed signal to the _on_New_Game_pressed() function. I assume you know how to do that from within the Node | Signals inspector panel?

jgodfrey | 2020-12-11 21:16

I clicked on node I think it was and there were a list of functions and I clicked the one I needed and it added it

Annoying_Brother | 2020-12-12 10:35

:bust_in_silhouette: Reply From: Annoying_Brother

Found the problem, My color rect was covering my button.