2026-05-02 23:08:42 +00:00
|
|
|
class_name Model extends Node2D
|
|
|
|
|
|
|
|
|
|
var CURRENT_TIME: int = 0
|
2026-05-03 02:48:39 +00:00
|
|
|
var last_droplet: int = 0
|
2026-05-03 05:13:12 +00:00
|
|
|
|
|
|
|
|
# tuning knobs
|
|
|
|
|
const PERIOD: int = 10 # smaller makes droplets faster
|
2026-05-03 04:34:46 +00:00
|
|
|
const DROP_PT_X = 450
|
2026-05-03 05:13:12 +00:00
|
|
|
const DROP_PT_Y = 400
|
|
|
|
|
const DROP_SIZE = 2
|
|
|
|
|
const DROP_TYPE = Droplet.Mode.SINKER
|
2026-05-02 23:08:42 +00:00
|
|
|
|
|
|
|
|
func _ready():
|
|
|
|
|
pass # Replace with function body.
|
|
|
|
|
|
|
|
|
|
func _process(delta: float):
|
2026-05-03 04:34:46 +00:00
|
|
|
CURRENT_TIME += delta * 100
|
2026-05-03 02:48:39 +00:00
|
|
|
if CURRENT_TIME - last_droplet > PERIOD:
|
|
|
|
|
last_droplet = CURRENT_TIME
|
|
|
|
|
# print("new droplet at time: ", str(CURRENT_TIME))
|
2026-05-02 23:08:42 +00:00
|
|
|
var droplet = preload("res://scenes/droplet.tscn").instantiate()
|
2026-05-03 02:48:39 +00:00
|
|
|
var shape = droplet.get_node("CollisionShape2D")
|
2026-05-03 05:13:12 +00:00
|
|
|
shape.shape.radius = DROP_SIZE
|
|
|
|
|
droplet.MODE = DROP_TYPE
|
|
|
|
|
droplet.global_position = Vector2(DROP_PT_X, DROP_PT_Y)
|
2026-05-02 23:08:42 +00:00
|
|
|
add_child(droplet)
|