My first 2D game in Godot 4.4
This commit is contained in:
24
survivors_game.gd
Normal file
24
survivors_game.gd
Normal file
@@ -0,0 +1,24 @@
|
||||
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
|
||||
Reference in New Issue
Block a user