class_name Sleigh extends Node3D static var instance: Sleigh static var streak: int: get: return streak set(value): streak = value UI.instance.setStreak(streak) static var score: int = 0 @onready var santa: Santa = $SleighModel/SantaModel @onready var cam: CameraController = $Camera3D @export var baseSpeed: float = 100 @export var maxSpeed: float = 500 @export var drag: float = 10 var speed: float func _enter_tree(): if (instance == null || !is_instance_valid(instance)): instance = self else: queue_free() # Called when the node enters the scene tree for the first time. func _ready() -> void: speed = baseSpeed # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta: float) -> void: if (!City.moving): return var distance: float = (speed * delta * Vector3.FORWARD).z position.z += distance if (is_instance_valid(City.instance)): City.instance.distance -= distance speed -= drag * delta speed = clampf(speed, baseSpeed, maxSpeed) func _on_rudolph_entered(area: Area3D) -> void: if (area is SpeedRing): speed *= area.strength if (area.is_in_group("delivery") && City.controlling): City.moving = false var target: Vector3 = City.instance.deliveryHouse.get_node("Smoke").global_position santa.dive(target, 1)