extends Node2D

var BallScene: PackedScene = preload("res://slides/204/physics_demo/Ball.tscn")

@export var dispersion_scale : Vector2 = Vector2.ONE


func _ready():
	spawn()


func spawn():
	var ball: PhysicsBody2D = BallScene.instantiate()
	var dispersion = Vector2(randf_range(-1.0, 1.0) * dispersion_scale.x, randf_range(-1.0, 1.0) * dispersion_scale.y)
	ball.position = dispersion

	add_child(ball)


func _on_delay_time_out():
	spawn()
