class_name OnRoadObject
extends Node2D

const DEADLINE: int = 500


func _ready() -> void:
	RideManager.get_instance().distance_changed.connect(_on_distance_changed)


func _physics_process(_delta: float) -> void:
	if global_position.y >= DEADLINE:
		queue_free()


func _on_distance_changed(pixels: int) -> void:
	global_position.y += pixels
