2015-09-16 01:07:03 +00:00
|
|
|
|
|
|
|
extends Node2D
|
|
|
|
|
2015-11-21 15:13:43 +00:00
|
|
|
# Member variables
|
|
|
|
const EMIT_INTERVAL = 0.1
|
|
|
|
var timeout = EMIT_INTERVAL
|
|
|
|
|
2015-09-16 01:07:03 +00:00
|
|
|
|
|
|
|
func _process(delta):
|
2015-11-21 15:13:43 +00:00
|
|
|
timeout -= delta
|
|
|
|
if (timeout < 0):
|
|
|
|
timeout = EMIT_INTERVAL
|
2015-09-16 01:07:03 +00:00
|
|
|
var ball = preload("res://ball.scn").instance()
|
2015-11-21 15:13:43 +00:00
|
|
|
ball.set_pos(Vector2(randf()*get_viewport_rect().size.x, 0))
|
2015-09-16 01:07:03 +00:00
|
|
|
add_child(ball)
|
|
|
|
|
|
|
|
|
2015-11-21 15:13:43 +00:00
|
|
|
func _ready():
|
|
|
|
set_process(true)
|