-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSpawner.gd
More file actions
28 lines (20 loc) · 769 Bytes
/
Spawner.gd
File metadata and controls
28 lines (20 loc) · 769 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
extends Node
@export var sourcePath: PathFollow3D
@export var targetPath: PathFollow3D
@export var controller: MouseController
@onready var timer = $"Timer"
@export var creeperScene: PackedScene
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
func _on_timer_timeout():
sourcePath.progress_ratio = randf()
targetPath.progress_ratio = randf()
var creeper = creeperScene.instantiate() as Creeper
get_parent().add_child(creeper)
creeper.setup(sourcePath.global_position, targetPath.global_position, controller)
timer.wait_time = 1.5 + 0.5 * randf()
pass # Replace with function body.