Merge pull request #1498 from mhilbrunner/mhilbrunner-step-by-step-script
Step-by-step scripting: Reorder functions
This commit is contained in:
commit
82044bddb6
|
@ -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,16 +298,16 @@ The final script should look like this:
|
|||
// this is case sensitive!
|
||||
public class sayhello : Panel
|
||||
{
|
||||
public override void _Ready()
|
||||
{
|
||||
GetNode("Button").Connect("pressed", this, nameof(_OnButtonPressed));
|
||||
}
|
||||
|
||||
public void _OnButtonPressed()
|
||||
{
|
||||
var label = (Label)GetNode("Label");
|
||||
label.Text = "HELLO!";
|
||||
}
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
GetNode("Button").Connect("pressed", this, nameof(_OnButtonPressed));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue