diff options
author | Lucas Fryzek <lucas.fryzek@fryzekconcepts.com> | 2023-09-24 21:47:25 -0400 |
---|---|---|
committer | Lucas Fryzek <lucas.fryzek@fryzekconcepts.com> | 2023-09-24 21:47:25 -0400 |
commit | 76660c93401e09042bbd2b73325428b839fcdfc2 (patch) | |
tree | a5d3751160ca6a5d5f85046a0287d82632e64bd8 | |
parent | 98dcf44062b92bf4f17b5e705257154413159880 (diff) |
Add seed tracker
-rw-r--r-- | scenes/main.tscn | 19 | ||||
-rw-r--r-- | scripts/player.gd | 4 |
2 files changed, 22 insertions, 1 deletions
diff --git a/scenes/main.tscn b/scenes/main.tscn index f7c295f..9ece0e8 100644 --- a/scenes/main.tscn +++ b/scenes/main.tscn @@ -52,9 +52,10 @@ shape = SubResource("BoxShape3D_gtg8d") mesh = SubResource("PlaneMesh_ypd0i") skeleton = NodePath("../..") -[node name="Player" parent="." node_paths=PackedStringArray("stam_bar") instance=ExtResource("3_8dect")] +[node name="Player" parent="." node_paths=PackedStringArray("stam_bar", "seed_text") instance=ExtResource("3_8dect")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 18.7109, 0, 0) stam_bar = NodePath("../StaminaBar") +seed_text = NodePath("../RichTextLabel/SeedText") [node name="StaticBody3D" type="StaticBody3D" parent="."] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 8.7194, 5, -6.35033) @@ -70,3 +71,19 @@ offset_left = 32.0 offset_top = 7.0 offset_right = 1103.0 offset_bottom = 34.0 + +[node name="RichTextLabel" type="RichTextLabel" parent="."] +offset_left = 34.0 +offset_top = 43.0 +offset_right = 201.0 +offset_bottom = 83.0 +text = "Seeds:" + +[node name="SeedText" type="RichTextLabel" parent="RichTextLabel"] +layout_mode = 0 +offset_left = 50.0 +offset_top = 2.0 +offset_right = 88.0 +offset_bottom = 42.0 +text = "0" +text_direction = 2 diff --git a/scripts/player.gd b/scripts/player.gd index 95878d0..f6a63a0 100644 --- a/scripts/player.gd +++ b/scripts/player.gd @@ -10,8 +10,10 @@ const STAM_REGEN = 10.0 #@export_node_path("ProgressBar") var stam_bar_path = null @export var stam_bar: ProgressBar = null; +@export var seed_text: RichTextLabel = null; var stamina: float = 100 +var num_seeds: int = 0 # Get the gravity from the project settings to be synced with RigidBody nodes. var gravity = ProjectSettings.get_setting("physics/3d/default_gravity") @@ -53,6 +55,7 @@ func throw(): func _ready(): assert(stam_bar != null, "Stamina bar is null") + assert(seed_text != null, "Seed text is null") Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) $ThirdPersonCamera.mouse_follow = true @@ -62,6 +65,7 @@ func _ready(): func _process(_delta): stam_bar.value = stamina + seed_text.text = str(num_seeds) func _physics_process(delta): var speed = SPEED |