28 lines
589 B
GDScript
28 lines
589 B
GDScript
extends CharacterBody2D
|
|
class_name RainDrop
|
|
|
|
@export var speed := 10.0
|
|
@export var lifetime := 3.0
|
|
@export var trail_lifetime := 1.0
|
|
@export var overall_scale := 1.0
|
|
|
|
func _ready() -> void:
|
|
apply_scale_to_all()
|
|
$TrailParticles.lifetime = trail_lifetime
|
|
$Timer.wait_time = lifetime
|
|
$Timer.start()
|
|
|
|
|
|
func _process(_delta: float) -> void:
|
|
velocity.y = speed
|
|
move_and_slide()
|
|
|
|
|
|
func apply_scale_to_all() -> void:
|
|
scale *= overall_scale
|
|
$TrailParticles.scale_amount_min = overall_scale
|
|
$TrailParticles.scale_amount_max = overall_scale
|
|
|
|
|
|
func _on_timer_timeout() -> void:
|
|
queue_free()
|