From 75cd80718792832b36cd5feea7f9e4e97f452175 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Fri, 29 Aug 2025 12:39:23 +0800 Subject: [PATCH] :lipstick: Optimize vfx of item pickup --- Scenes/Root.tscn | 2 ++ Scenes/System/ItemPickup.tscn | 8 ++++++++ Scripts/System/ItemPickup.cs | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+) diff --git a/Scenes/Root.tscn b/Scenes/Root.tscn index 2fd5ae9..76b3edf 100644 --- a/Scenes/Root.tscn +++ b/Scenes/Root.tscn @@ -37,9 +37,11 @@ Inventory = NodePath("../ResourceSystem") [node name="ItemPickup" parent="." instance=ExtResource("7_is6ib")] position = Vector2(-496, -245) ItemId = "stone" +Quantity = 64 Infinite = true [node name="ItemPickup2" parent="." instance=ExtResource("7_is6ib")] position = Vector2(-495, 5) ItemId = "ore_iron" +Quantity = 16 Infinite = true diff --git a/Scenes/System/ItemPickup.tscn b/Scenes/System/ItemPickup.tscn index 49762be..4d0b51e 100644 --- a/Scenes/System/ItemPickup.tscn +++ b/Scenes/System/ItemPickup.tscn @@ -17,3 +17,11 @@ texture = ExtResource("1_4weev") [node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] shape = SubResource("RectangleShape2D_4weev") + +[node name="Label" type="Label" parent="."] +offset_left = -20.0 +offset_right = 20.0 +offset_bottom = 23.0 +theme_override_font_sizes/font_size = 0 +text = "x1" +horizontal_alignment = 1 diff --git a/Scripts/System/ItemPickup.cs b/Scripts/System/ItemPickup.cs index 990f694..62020e6 100644 --- a/Scripts/System/ItemPickup.cs +++ b/Scripts/System/ItemPickup.cs @@ -11,6 +11,8 @@ public partial class ItemPickup : Node2D [Export] public bool Infinite { get; set; } = false; private Sprite2D _sprite; + private Label _quantityLabel; + private Sprite2D _shadowSprite; // Called when the node enters the scene tree public override void _Ready() @@ -20,6 +22,37 @@ public partial class ItemPickup : Node2D _sprite = GetNode("Sprite2D"); UpdateTexture(); + + // Get the Label node for quantity + if (HasNode("Label")) + { + _quantityLabel = GetNode