adjustable wave size with debug parameter "mat_wave_size"
This commit is contained in:
Binary file not shown.
@@ -101,6 +101,7 @@ func _register_all() -> void:
|
||||
# Wave system: matadors enter the arena in escalating waves (1 → 2 → … → N where N
|
||||
# is the number of placed spawn points). mat_spawn_stagger is the delay between each
|
||||
# matador leaping in within a wave; mat_wave_pause is the breather after a wave clears.
|
||||
_reg_f("Matador", "mat_wave_size", 8.0, 1, 50)
|
||||
_reg_f("Matador", "mat_spawn_stagger", 0.4, 0.0, 3.0, 0.05)
|
||||
_reg_f("Matador", "mat_wave_pause", 2.0, 0.0, 8.0, 0.25)
|
||||
_reg_f("Matador", "mat_walk_speed", 5.5, 0.5, 10.0)
|
||||
|
||||
+20
-6
@@ -34,15 +34,29 @@ func _spawn() -> void:
|
||||
# Matadors are assigned to a random subset of spawn points each wave and enter staggered.
|
||||
func _start_next_wave() -> void:
|
||||
_wave += 1
|
||||
var count := mini(_wave, _spawn_points.size())
|
||||
var points: Array = _spawn_points.duplicate()
|
||||
|
||||
# 8 waves total.
|
||||
if _wave > DP.f("mat_wave_size"):
|
||||
return
|
||||
|
||||
# Wave 1 = 1 matador, Wave 2 = 2, ... Wave 8 = 8.
|
||||
var count := _wave
|
||||
|
||||
# Shuffle the spawn points so the spawn locations are random.
|
||||
var points: Array[Node3D] = _spawn_points.duplicate()
|
||||
points.shuffle()
|
||||
for i: int in count:
|
||||
var sp := points[i] as Node3D
|
||||
|
||||
for i in range(count):
|
||||
# Reuse spawn points when we have more matadors than points.
|
||||
var sp: Node3D = points[i % points.size()]
|
||||
|
||||
var m := _spawn_at(sp.global_position)
|
||||
m.call_deferred(&"enter_spawn_roll", Vector3.ZERO)
|
||||
|
||||
if i < count - 1:
|
||||
await get_tree().create_timer(DP.f("mat_spawn_stagger")).timeout
|
||||
await get_tree().create_timer(
|
||||
DP.f("mat_spawn_stagger")
|
||||
).timeout
|
||||
|
||||
|
||||
func _place_bull(angle: float, arena_r: float) -> void:
|
||||
@@ -68,7 +82,7 @@ func _on_matador_killed() -> void:
|
||||
_alive -= 1
|
||||
if _alive > 0 or _resolved:
|
||||
return
|
||||
if _wave >= _spawn_points.size():
|
||||
if _wave >= DP.f("mat_wave_size"):
|
||||
_resolved = true
|
||||
all_defeated.emit()
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user