Hello guys,
I'm new to game development and programming (only have rudimentary knowledge of Python and now am studying Invent Your Own Computer Games with Python) so this might be a newbie question. I've done some searches but couldn't find the answer (or too green to spot the answer...)
Currently I'm following the Scripting section under Step by Step, Getting Started in the Godot Docs where I've learned to write the following code:
extends Panel
func _ready():
get_node("Button").connect("pressed", self, "_on_Button_pressed")
func _on_Button_pressed():
get_node("Label").text = "HELLO!"
I clicked on the button and got the hello text. So far so good. Then it occurred to me to remove the connect function to see if I can get the same result because I reasoned if I'd already fetched the "Button", and that the Button had already been defined with a method, then when I pressed the button the method should activate procedurally, therefore there would be no need for the connect function. So I deleted it and tried it out and it worked just fine.
So what's the difference here with and without the connect function? What am I missing?
Thanks!