25 lines
517 B
GDScript
25 lines
517 B
GDScript
extends Node2D
|
|
|
|
func _ready():
|
|
spawn_monster()
|
|
spawn_monster()
|
|
spawn_monster()
|
|
spawn_monster()
|
|
spawn_monster()
|
|
%SpawnTimer.start()
|
|
|
|
func spawn_monster():
|
|
var new_monster = preload("res://monster.tscn").instantiate()
|
|
%PathFollow2D.progress_ratio = randf()
|
|
new_monster.global_position = %PathFollow2D.global_position
|
|
add_child(new_monster)
|
|
|
|
|
|
func _on_spawn_timer_timeout() -> void:
|
|
spawn_monster()
|
|
|
|
|
|
func _on_player_health_depleted() -> void:
|
|
%GameoverCanvasLayer.visible = true
|
|
get_tree().paused = true
|