class_name Compass
extends Control

const TEX_WIDTH: int = 1152
const TEX_OFFSET: int = -936
const COMPASS_SPEED: float = 10.0

var target: float = 0

var _offset: float = TEX_OFFSET

@onready var compass_texture: TextureRect = $CompassTexture


func _process(delta: float) -> void:
	_offset = lerp_angle(_offset, target, delta * COMPASS_SPEED)
	compass_texture.position.x = int(_offset * TEX_WIDTH / (2 * PI)) % TEX_WIDTH
