Stabelized survivor spawning.
This commit is contained in:
parent
0b47cc7b38
commit
a95eaa4dfb
2 changed files with 16 additions and 14 deletions
|
|
@ -12,17 +12,18 @@ var spawn_readiness: bool = false
|
|||
@onready var start_pos = survivor_spawn.global_position
|
||||
|
||||
func _ready() -> void:
|
||||
spawn_readiness = false
|
||||
|
||||
func _physics_process(delta):
|
||||
if spawn_readiness == true:
|
||||
spawn_survivor()
|
||||
spawn_readiness = false
|
||||
|
||||
else:
|
||||
await get_tree().create_timer(survivor_rate).timeout
|
||||
start()
|
||||
|
||||
func start() -> void:
|
||||
spawn_readiness = true
|
||||
|
||||
spawn_survivor()
|
||||
|
||||
#func _physics_process(delta):
|
||||
#if spawn_readiness == true:
|
||||
#spawn_survivor()
|
||||
#spawn_readiness = false
|
||||
#
|
||||
#else: pass
|
||||
|
||||
func spawn_survivor():
|
||||
|
||||
|
|
@ -31,12 +32,13 @@ func spawn_survivor():
|
|||
else:
|
||||
|
||||
var survivor_delay: float = randf_range(1, 2.5)
|
||||
var s = survivor.instantiate()
|
||||
var start_variance = Vector3((randf_range(-1, 2)),0,0)
|
||||
|
||||
for x in range(survivors):
|
||||
get_tree().root.add_child(s)
|
||||
var s = survivor.instantiate()
|
||||
get_tree().root.add_child.call_deferred(s)
|
||||
#get_node("/root/Game/World").add_child(s)
|
||||
s.position = start_pos
|
||||
s.position = start_pos + start_variance
|
||||
await get_tree().create_timer(survivor_rate * survivor_delay).timeout
|
||||
spawn_readiness = true
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
extends CharacterBody3D
|
||||
|
||||
var speed: int = 5
|
||||
var speed: int = 3
|
||||
var clumsiness: int = 0
|
||||
|
||||
@onready var safety_zone = get_node("/root/Game/World/ElevatorDoors/ElevatorSafeZone")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue