extends VinePlatform

@export var jump_speed: float = 600.0  # 向上的初速度

##跳跃声音特效
signal s_jump_sound

func _ready() -> void:
	super._ready()


func _on_player_entered(body: Node) -> void:
	# 只处理 CharacterBody2D
	if body is Player:
		_trigger_platform()
		# 给予垂直向上的速度
		var dir := -global_transform.y.normalized()
		body.velocity = dir * jump_speed
		# 播放弹簧音效
		on_ejection()
		# 触发破碎机制
		_trigger_platform()
		

func on_ejection() -> void:
	# 播放弹簧音效
	s_jump_sound.emit()
