From 0127257d05676383f15b5a740618eb233cef47e3 Mon Sep 17 00:00:00 2001 From: Dan Baker Date: Sun, 5 May 2024 08:01:25 +0100 Subject: [PATCH] Adding required nectar to game state --- entities/Bee.tscn | 3 +++ ui/scripts/ui_component.gd | 1 + utility/game_state.gd | 8 +++++++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/entities/Bee.tscn b/entities/Bee.tscn index 0b97982..e1737cb 100644 --- a/entities/Bee.tscn +++ b/entities/Bee.tscn @@ -104,7 +104,10 @@ polygon = PackedVector2Array(-18, -11, -6, -21, 17, -19, 23, 1, 3, 12, -18, 7) [node name="CPUParticles2D" type="CPUParticles2D" parent="Polygon2D"] position = Vector2(0, 2.46663) +lifetime_randomness = 0.33 gravity = Vector2(0, 0) +linear_accel_min = 5.0 +linear_accel_max = 10.0 [node name="Polygon2D" type="Polygon2D" parent="Polygon2D"] position = Vector2(-13.0817, -6.25862) diff --git a/ui/scripts/ui_component.gd b/ui/scripts/ui_component.gd index 9b0abd1..7ee9a5f 100644 --- a/ui/scripts/ui_component.gd +++ b/ui/scripts/ui_component.gd @@ -21,3 +21,4 @@ func update_ui(): Log.pr("UIComponent update_ui") nectar_bar.value = GameState.gathered_nectar + nectar_bar.max_value = GameState.required_nectar diff --git a/utility/game_state.gd b/utility/game_state.gd index 343419f..7f62ada 100644 --- a/utility/game_state.gd +++ b/utility/game_state.gd @@ -1,6 +1,12 @@ class_name GameStateManager extends Node -var gathered_nectar : int = 0 +var gathered_nectar : int = 0 : + get: + return gathered_nectar + set(value): + gathered_nectar = value + +@export var required_nectar : int = 200 func _ready(): Log.pr("GameStateManager ready")