fixat mer med traps och arrows och grejjer

This commit is contained in:
2026-01-22 01:03:01 +01:00
parent c0d229ee86
commit eaf86b39fa
20 changed files with 1589 additions and 194 deletions

View File

@@ -54,6 +54,9 @@ var item: Item = null # Item instance (for LootType.ITEM)
@onready var sfx_banana_collect = $SfxBananaCollect
@onready var sfx_key_collect = $SfxKeyCollect
# Quantity badge for items with quantity > 1
var quantity_badge: Label = null
func _ready():
add_to_group("loot")
@@ -150,6 +153,10 @@ func _setup_sprite():
sprite.vframes = item.spriteFrames.y if item.spriteFrames.y > 0 else 14
sprite.frame = item.spriteFrame
print("Loot: Set up item sprite for ", item.item_name, " frame=", sprite.frame)
# Add quantity badge if quantity > 1
if item.quantity > 1:
_create_quantity_badge(item.quantity)
else:
print("Loot: ERROR - Could not load texture from spritePath: ", item.spritePath)
else:
@@ -179,6 +186,18 @@ func _setup_collision_shape():
collision_shape.shape = circle_shape
func _create_quantity_badge(quantity: int):
# Create a label to show the quantity
quantity_badge = Label.new()
quantity_badge.text = str(quantity)
quantity_badge.add_theme_font_size_override("font_size", 8)
quantity_badge.add_theme_color_override("font_color", Color.WHITE)
quantity_badge.add_theme_color_override("font_outline_color", Color.BLACK)
quantity_badge.add_theme_constant_override("outline_size", 2)
quantity_badge.z_index = 100 # Above the sprite
quantity_badge.position = Vector2(6, -8) # Bottom right of sprite
add_child(quantity_badge)
func _physics_process(delta):
# Stop all physics processing if collected
if collected: