TowerDefense/VFX/pixel_drop.gd

29 lines
589 B
GDScript3
Raw Permalink Normal View History

2025-08-21 00:10:15 +02:00
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:
2025-08-21 00:10:15 +02:00
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()