mirror of
https://github.com/Steffo99/pineapple-surf.git
synced 2024-11-25 17:24:19 +00:00
24 lines
516 B
GDScript
24 lines
516 B
GDScript
extends Node
|
|
|
|
|
|
@export_node_path(CharacterBody3D) var target_path: NodePath
|
|
@export var splash_threshold: float = 0.0
|
|
|
|
@onready var target: CharacterBody3D = get_node(target_path)
|
|
@onready var spawn_point: Vector3 = target.position
|
|
@onready var splash_sound: AudioStreamPlayer = $SplashSound
|
|
|
|
|
|
signal splashed()
|
|
|
|
|
|
func splash():
|
|
splash_sound.play()
|
|
target.position = spawn_point
|
|
target.velocity = Vector3.ZERO
|
|
emit_signal("splashed")
|
|
|
|
|
|
func _process(_delta):
|
|
if target.position.y < splash_threshold:
|
|
splash()
|