water-testing/scripts/model.gd

20 lines
591 B
GDScript3
Raw Normal View History

2026-05-02 23:08:42 +00:00
class_name Model extends Node2D
const PERIOD: int = 20 # smaller makes droplets faster
2026-05-02 23:08:42 +00:00
var CURRENT_TIME: int = 0
var last_droplet: int = 0
2026-05-02 23:08:42 +00:00
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))
2026-05-02 23:08:42 +00:00
var droplet = preload("res://scenes/droplet.tscn").instantiate()
var shape = droplet.get_node("CollisionShape2D")
shape.shape.radius = 5
droplet.global_position = Vector2(450, 100)
2026-05-02 23:08:42 +00:00
add_child(droplet)