mirror of
https://github.com/Steffo99/hella-farm.git
synced 2024-11-24 00:54:22 +00:00
26 lines
484 B
GDScript
26 lines
484 B
GDScript
extends PanelContainer
|
|
class_name GoldDisplay
|
|
|
|
|
|
@onready var label: Label = %"Label"
|
|
@onready var animator: AnimationPlayer = %"Animator"
|
|
|
|
|
|
func set_text(value: int) -> void:
|
|
label.text = "%d €" % value
|
|
|
|
func increase(value: int):
|
|
set_text(value)
|
|
animator.stop()
|
|
animator.play(&"increase")
|
|
|
|
func decrease(value: int):
|
|
set_text(value)
|
|
animator.stop()
|
|
animator.play(&"decrease")
|
|
|
|
func change(new: int, old: int):
|
|
if new > old:
|
|
increase(new)
|
|
elif old > new:
|
|
decrease(new)
|