summaryrefslogtreecommitdiff
path: root/demos/2d/dynamic_collision_shapes/dynamic_colobjs.gd
blob: 1595195c74c3382dfea91e084503cf86be65c1f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

extends Node2D

# Member variables
const EMIT_INTERVAL = 0.1
var timeout = EMIT_INTERVAL


func _process(delta):
	timeout -= delta
	if (timeout < 0):
		timeout = EMIT_INTERVAL
		var ball = preload("res://ball.scn").instance()
		ball.set_pos(Vector2(randf()*get_viewport_rect().size.x, 0))
		add_child(ball)


func _ready():
	# Initialization here
	set_process(true)