Post Game jam commit
This commit is contained in:
commit
6db2131520
164 changed files with 172524 additions and 0 deletions
36
scripts/enemy_spawn.gd
Normal file
36
scripts/enemy_spawn.gd
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
extends Node2D
|
||||
|
||||
@export var enemies: Array[PackedScene] # Drag your enemy .tscn here
|
||||
@export var num_circles: int = 3 # How many rings of enemies
|
||||
@export var enemies_per_circle: int = 8 # Base number of enemies
|
||||
@export var radius_step: float = 100.0 # Distance between each ring
|
||||
@export var initial_radius: float = 150.0
|
||||
|
||||
func _ready() -> void:
|
||||
spawn_concentric_horde()
|
||||
|
||||
func spawn_concentric_horde() -> void:
|
||||
for i in range(num_circles):
|
||||
# We calculate the radius for this specific ring
|
||||
var current_radius = initial_radius + (i * radius_step)
|
||||
|
||||
for j in range(enemies_per_circle):
|
||||
spawn_enemy_at_random_angle(current_radius)
|
||||
|
||||
func spawn_enemy_at_random_angle(radius: float) -> void:
|
||||
var random_angle = randf_range(0, 2 * PI)
|
||||
|
||||
|
||||
var spawn_pos = Vector2(
|
||||
radius * cos(random_angle),
|
||||
radius * sin(random_angle)
|
||||
)
|
||||
|
||||
var idx1 = randi() % len(enemies)
|
||||
var idx2 = randi() % len(enemies)
|
||||
var idx = min(idx1, idx2)
|
||||
print(idx)
|
||||
var enemy_instance = enemies[idx].instantiate()
|
||||
add_child(enemy_instance)
|
||||
|
||||
enemy_instance.position = spawn_pos
|
||||
Loading…
Add table
Add a link
Reference in a new issue