|
@@ -284,12 +284,12 @@ The final script should look like this:
|
|
|
|
|
|
extends Panel
|
|
|
|
|
|
- func _on_button_pressed():
|
|
|
- get_node("Label").text = "HELLO!"
|
|
|
-
|
|
|
func _ready():
|
|
|
get_node("Button").connect("pressed", self, "_on_button_pressed")
|
|
|
|
|
|
+ func _on_button_pressed():
|
|
|
+ get_node("Label").text = "HELLO!"
|
|
|
+
|
|
|
.. code-tab:: csharp
|
|
|
|
|
|
using Godot;
|
|
@@ -298,15 +298,15 @@ The final script should look like this:
|
|
|
// this is case sensitive!
|
|
|
public class sayhello : Panel
|
|
|
{
|
|
|
- public void _OnButtonPressed()
|
|
|
+ public override void _Ready()
|
|
|
{
|
|
|
- var label = (Label)GetNode("Label");
|
|
|
- label.Text = "HELLO!";
|
|
|
+ GetNode("Button").Connect("pressed", this, nameof(_OnButtonPressed));
|
|
|
}
|
|
|
|
|
|
- public override void _Ready()
|
|
|
+ public void _OnButtonPressed()
|
|
|
{
|
|
|
- GetNode("Button").Connect("pressed", this, nameof(_OnButtonPressed));
|
|
|
+ var label = (Label)GetNode("Label");
|
|
|
+ label.Text = "HELLO!";
|
|
|
}
|
|
|
}
|
|
|
|