diff --git a/island/Pineapple.gd b/island/Pineapple.gd index 5b50d9a..af5c0bb 100644 --- a/island/Pineapple.gd +++ b/island/Pineapple.gd @@ -5,6 +5,4 @@ extends RigidBody3D func _on_collectible_by_player_collected(): - # var player: Node3D = Singletons.player - # player.scale *= 1.05 - pass + player.collected_fruit += 1 diff --git a/player/Player.gd b/player/Player.gd index e9e9a2a..3bd7fe5 100644 --- a/player/Player.gd +++ b/player/Player.gd @@ -22,8 +22,15 @@ const AIR_ACCELERATE = 100 # Hu/39.97 @onready var active_weapon: BaseWeapon: get: return OnHand.active_weapon -# DEBUG NODES @onready var ammo_label = $HUD/AmmoLabel +@onready var fruit_label = $HUD/PineappleLabel + +var collected_fruit: int = 0: + get: + return collected_fruit + set(value): + collected_fruit = value + fruit_label.text = "%d harvested" % collected_fruit var last_frame_input_data: PlayerInputData = PlayerInputData.new() var input_data: PlayerInputData = PlayerInputData.new() diff --git a/player/Player.tscn b/player/Player.tscn index 53a99f7..800b495 100644 --- a/player/Player.tscn +++ b/player/Player.tscn @@ -79,6 +79,7 @@ grow_horizontal = 2 grow_vertical = 2 [node name="CameraViewportContainer" type="SubViewportContainer" parent="Head/Viewport"] +layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 @@ -118,6 +119,7 @@ theme = SubResource("Theme_smyke") [node name="SubViewportContainer" type="SubViewportContainer" parent="HUD"] show_behind_parent = true +layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 @@ -146,7 +148,23 @@ position = Vector2(140, 79) scale = Vector2(1.65, 1) metadata/_edit_lock_ = true +[node name="PineappleLabel" type="Label" parent="HUD"] +layout_mode = 1 +anchors_preset = 2 +anchor_top = 1.0 +anchor_bottom = 1.0 +offset_left = 8.0 +offset_top = -26.0 +offset_right = 106.0 +offset_bottom = -8.0 +grow_vertical = 0 +theme = ExtResource("4_d7ru6") +theme_override_font_sizes/font_size = 16 +text = "0 harvested" +vertical_alignment = 2 + [node name="AmmoLabel" type="Label" parent="HUD"] +layout_mode = 1 anchors_preset = 3 anchor_left = 1.0 anchor_top = 1.0 @@ -166,6 +184,7 @@ vertical_alignment = 2 [node name="Crosshair" type="ColorRect" parent="HUD"] material = SubResource("ShaderMaterial_2p6rt") +layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0