diff --git a/scripts/Statemachine/EntityBase.gd b/scripts/Statemachine/EntityBase.gd index 50d112c..1abb597 100644 --- a/scripts/Statemachine/EntityBase.gd +++ b/scripts/Statemachine/EntityBase.gd @@ -84,7 +84,7 @@ func _ready(): ) itemCollected.connect( func(itemType, amount): - UIState.itemCollect.add_child(ItemShow.generate(itemType, amount)) + UIState.itemCollect.add_child(ItemShow.generate(itemType, amount, true)) ) else: currentFocusedBoss = get_tree().get_nodes_in_group("players")[0] diff --git a/scripts/Statemachine/ItemShow.gd b/scripts/Statemachine/ItemShow.gd index cdda528..e2c611f 100644 --- a/scripts/Statemachine/ItemShow.gd +++ b/scripts/Statemachine/ItemShow.gd @@ -19,8 +19,9 @@ func _physics_process(_delta): avatarTexture.texture = ItemStore.getTexture(type) countLabel.text = str(count) -static func generate(itemType: ItemStore.ItemType, itemCount: int = 1): +static func generate(itemType: ItemStore.ItemType, itemCount: int = 1, isAutoFree: bool = false): var item = preload("res://components/UI/ItemShow.tscn").instantiate() item.type = itemType item.count = itemCount + item.autoFree = isAutoFree return item