21 lines
615 B
GDScript
21 lines
615 B
GDScript
class_name Model extends Node2D
|
|
|
|
const PERIOD: int = 20 # smaller makes droplets faster
|
|
var CURRENT_TIME: int = 0
|
|
var last_droplet: int = 0
|
|
const DROP_PT_X = 450
|
|
|
|
func _ready():
|
|
pass # Replace with function body.
|
|
|
|
func _process(delta: float):
|
|
CURRENT_TIME += delta * 100
|
|
if CURRENT_TIME - last_droplet > PERIOD:
|
|
last_droplet = CURRENT_TIME
|
|
# print("new droplet at time: ", str(CURRENT_TIME))
|
|
var droplet = preload("res://scenes/droplet.tscn").instantiate()
|
|
var shape = droplet.get_node("CollisionShape2D")
|
|
shape.shape.radius = 5
|
|
droplet.global_position = Vector2(DROP_PT_X, 100)
|
|
add_child(droplet)
|