class_name Obstacle
extends OnRoadObject

@export var collision_area: Area2D = null


func _ready() -> void:
	super()
	collision_area.area_entered.connect(_on_area_entered)


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


func _on_area_entered(area: Area2D) -> void:
	if area.has_method("destroy"):
		area.destroy()
