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