12345678910111213141516171819202122232425 |
- extends Position2D
- var Ball: PackedScene = preload("res://labs/cascade/component/ball/Ball.tscn")
- export(Vector2) var dispersion_scale = Vector2.ONE
- export(float) var delay = 1
- func _ready():
- spawn()
- func spawn():
- print("spawn")
- var ball: PhysicsBody2D = Ball.instance()
- var dispersion = Vector2(randf() * dispersion_scale.x, randf() * dispersion_scale.y)
- ball.position = dispersion
- add_child(ball)
- get_tree().create_timer(delay).connect("timeout", self, "_on_delay_time_out")
- func _on_delay_time_out():
- spawn()
|