2024-08-19 16:53:54 +03:00
|
|
|
extends Node2D
|
|
|
|
|
|
|
|
func _ready() -> void:
|
2024-08-26 11:55:38 +03:00
|
|
|
for flock in get_children():
|
2024-08-29 17:59:46 +03:00
|
|
|
for i in 1000: spawnBoid(flock)
|
2024-08-19 16:53:54 +03:00
|
|
|
|
2024-08-29 04:51:21 +03:00
|
|
|
func spawnBoid(flock: Flock2D) -> void:
|
2024-08-26 11:55:38 +03:00
|
|
|
var boid: Boid2D = preload("../example_boid.tscn").instantiate()
|
2024-08-19 16:53:54 +03:00
|
|
|
var screensize := get_viewport_rect().size
|
|
|
|
boid.modulate = Color(randf(), randf(), randf(), 1)
|
|
|
|
boid.global_position = Vector2((randf_range(200, screensize.x - 200)), (randf_range(200, screensize.y - 200)))
|
2024-08-26 11:55:38 +03:00
|
|
|
flock.add_child(boid)
|