From fd406c55d05f172589b4cf14377d7cc568e5d2b7 Mon Sep 17 00:00:00 2001 From: Jan Tuomi Date: Sat, 1 Aug 2020 16:49:06 +0300 Subject: Allow disabling debug --- scenes/GUI.tscn | 2 +- scripts/GUI.gd | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/scenes/GUI.tscn b/scenes/GUI.tscn index 8a328c8..6434d81 100644 --- a/scenes/GUI.tscn +++ b/scenes/GUI.tscn @@ -17,6 +17,6 @@ __meta__ = { margin_right = 984.0 margin_bottom = 14.0 -[node name="Label" type="Label" parent="VBoxContainer"] +[node name="DebugLabel" type="Label" parent="VBoxContainer"] margin_right = 984.0 margin_bottom = 14.0 diff --git a/scripts/GUI.gd b/scripts/GUI.gd index 1e0a781..90a84bb 100644 --- a/scripts/GUI.gd +++ b/scripts/GUI.gd @@ -1,5 +1,7 @@ extends MarginContainer class_name GUI +export (bool) var show_debug = true +onready var debug_label = $VBoxContainer/DebugLabel # Declare member variables here. Examples: # var a = 2 @@ -8,11 +10,11 @@ class_name GUI # Called when the node enters the scene tree for the first time. func _ready(): - pass # Replace with function body. + debug_label.set_visible(show_debug) # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(_delta): pass func set_debug_text(text: String): - $VBoxContainer/Label.set_text(text) + debug_label.set_text(text) -- cgit v1.3