diff --git a/player/smallPlayer/menus/Score bar.tscn b/player/smallPlayer/menus/Score bar.tscn new file mode 100644 index 0000000..d9593b1 --- /dev/null +++ b/player/smallPlayer/menus/Score bar.tscn @@ -0,0 +1,18 @@ +[gd_scene load_steps=2 format=3 uid="uid://cnvs3iophpe3n"] + +[ext_resource type="Script" uid="uid://biv656fho5bpy" path="res://player/smallPlayer/menus/progress_bar.gd" id="1_qy0dt"] + +[node name="Control" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="CanvasLayer" type="CanvasLayer" parent="."] + +[node name="ProgressBar" type="ProgressBar" parent="CanvasLayer"] +offset_right = 367.0 +offset_bottom = 27.0 +script = ExtResource("1_qy0dt") diff --git a/player/smallPlayer/menus/progress_bar.gd b/player/smallPlayer/menus/progress_bar.gd new file mode 100644 index 0000000..2e96857 --- /dev/null +++ b/player/smallPlayer/menus/progress_bar.gd @@ -0,0 +1,13 @@ +extends ProgressBar + + +func _ready() -> void: + await get_tree().process_frame + var crystals = get_tree().get_nodes_in_group("crystals") + print("Got " + str(crystals.size()) + " crystals") + for crystal in crystals: + print("Connecting crystal: " + crystal.name) + crystal.connect("crystal_picked_up", Callable(self, "collect")) + +func collect(): + value += 2.0 diff --git a/player/smallPlayer/menus/progress_bar.gd.uid b/player/smallPlayer/menus/progress_bar.gd.uid new file mode 100644 index 0000000..b0c463c --- /dev/null +++ b/player/smallPlayer/menus/progress_bar.gd.uid @@ -0,0 +1 @@ +uid://biv656fho5bpy