21 lines
620 B
GDScript
21 lines
620 B
GDScript
extends AnimatedSprite2D
|
|
|
|
var juiceAnimScene = preload("res://UI/Juicing/juiceAnim.tscn")
|
|
|
|
func _ready():
|
|
play()
|
|
|
|
func juice_item(item:Item):
|
|
var newJuiceAnim = juiceAnimScene.instantiate()
|
|
|
|
newJuiceAnim.get_node("Item").texture = item.get_sprite()
|
|
newJuiceAnim.get_node("Juice").self_modulate = SpriteGeneration.get_average_color(item.get_sprite().get_image())
|
|
|
|
newJuiceAnim.get_node("Item").visible = true
|
|
if Item.types.Unjuiceable in item.itemTypes:
|
|
newJuiceAnim.get_node("AnimationPlayer").play("JuiceUnjuiceable")
|
|
else:
|
|
newJuiceAnim.get_node("AnimationPlayer").play("Juice")
|
|
|
|
add_child(newJuiceAnim)
|