grunk/src/ui/hud/grunk_counter/grunk_counter.gd

21 lines
564 B
GDScript3
Raw Normal View History

2025-03-07 19:26:12 -07:00
extends HBoxContainer
## Does a funky lil bump when you collect tha grunk
const COUNTER_BUMP_RATE := 0.3
@onready var counter: Label = %Counter
func _ready() -> void:
Game.manager.grunk_collected.connect(on_grunk_collected)
counter.pivot_offset = Vector2(0, counter.size.y)
func on_grunk_collected(delta: float) -> void:
counter.text = str(int(Game.manager.grunk_tank))
counter.scale = Vector2.ONE + Vector2.ONE * clampf(delta / 128.0, 0.1, 1.0)
func _process(_delta: float) -> void:
counter.scale = counter.scale.lerp(Vector2.ONE, COUNTER_BUMP_RATE)