extends Area2D

@export var duration: float = 5.0
@export var jump_multiplier: float = 1.5

@onready var animation_player: AnimationPlayer = $AnimationPlayer

func _on_body_entered(body: Node2D) -> void:
	if body.is_in_group("player"):
		animation_player.play("pickup")
		_apply_boost(body)

func _apply_boost(player: Node) -> void:
	var base_jump = player.jump_velocity
	player.jump_velocity = base_jump * jump_multiplier
	await get_tree().create_timer(duration).timeout
	if is_instance_valid(player):
		player.jump_velocity = base_jump
