24 lines
539 B
GDScript3
24 lines
539 B
GDScript3
|
extends Node2D
|
||
|
|
||
|
@export var common_parent: Node2D
|
||
|
@export var path_follow: PathFollow2D
|
||
|
|
||
|
@export var target: PackedScene
|
||
|
@export var common_target: Node2D
|
||
|
|
||
|
func spawn():
|
||
|
var instance = target.instantiate()
|
||
|
|
||
|
# Randomize
|
||
|
path_follow.progress_ratio = randi()
|
||
|
instance.position = path_follow.position
|
||
|
|
||
|
var target_scale = randf_range(0.2, 0.95)
|
||
|
instance.scale = Vector2(target_scale, target_scale)
|
||
|
instance.speed = randi_range(800, 1400)
|
||
|
|
||
|
instance.target = common_target
|
||
|
|
||
|
# Add into common parent
|
||
|
common_parent.add_child(instance)
|