in my game scene i have panel that have the script and the child is a label and a button . The label will display a text when the button is press so there is no script attach to the button. within my panel script i can access the label.text properties and modify as needed using $ and Button.connect()
based on this, so i guess self refer to the Panel node if silicon28 is right, does not make no sense. i thought the button is the self.
But you are still connecting it to a node: .connect(<singal name>, <node to connect it to>, <target function name>)
what node am i connecting my signal too? is it Panel?
i trying to call a function when my button get pressed but i don't know what self is? i believe signal is irrelevant. for simplicity
if(buttonIsPress == true){
#call the function _on_button_pressed()
#what is self?
{
script 1 the original
extends Panel
func _ready():
$Button.connect('pressed', self, '_on_button_pressed')
func _on_button_pressed():
#get_node("label").text = "HELLO!"
$label.text = 'what is up ya!'
this example is based on silicon28 explanation unfortunately it does not work
i have a script that is attach to the button.
script 2
extends Button
func _ready():
$Button.connect('pressed', self, '_on_button_pressed')
func _on_button_pressed():
$label.text = 'what is up everyone!'