From e164cef2c2dc1da46e8ee05dd89c17ad6ae696cd Mon Sep 17 00:00:00 2001 From: VAILLANT Jeremy Date: Sat, 8 May 2021 13:16:13 +0200 Subject: [PATCH] Quit the game --- scenes/main.gd | 5 +++++ scenes/main.tscn | 15 +++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 scenes/main.gd diff --git a/scenes/main.gd b/scenes/main.gd new file mode 100644 index 0000000..8c33aee --- /dev/null +++ b/scenes/main.gd @@ -0,0 +1,5 @@ +extends Node + +# Quit the game +func _on_Quit_pressed(): + get_tree().quit(0) diff --git a/scenes/main.tscn b/scenes/main.tscn index 793627f..9dbff2e 100644 --- a/scenes/main.tscn +++ b/scenes/main.tscn @@ -1,6 +1,14 @@ -[gd_scene format=2] +[gd_scene load_steps=3 format=2] -[node name="Main" type="Node2D"] +[ext_resource path="res://scenes/main.gd" type="Script" id=1] + +[sub_resource type="GDScript" id=1] +script/source = "extends LinkButton + +# Quit the game with properly exit code" + +[node name="Main" type="Node"] +script = ExtResource( 1 ) [node name="Grid" type="GridContainer" parent="."] margin_left = -1.33484 @@ -40,3 +48,6 @@ margin_top = 72.0 margin_right = 151.0 margin_bottom = 86.0 text = "Quitter" +script = SubResource( 1 ) + +[connection signal="pressed" from="Grid/Quit" to="." method="_on_Quit_pressed"]