Merge pull request #1498 from mhilbrunner/mhilbrunner-step-by-step-script

Step-by-step scripting: Reorder functions
This commit is contained in:
Max Hilbrunner 2018-06-04 02:33:15 +02:00 committed by GitHub
commit 82044bddb6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 8 deletions

View File

@ -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));
}
}