class_name Wheel
extends RigidBody2D

export var min_linear_speed = 150
export var max_linear_speed = 250
export var max_angular_speed = TAU


func attack(from: Vector2, angle: float):
	position = from

	var speed = rand_range(min_linear_speed, max_linear_speed)
	linear_velocity = Vector2(speed, 0).rotated(angle)

	angular_velocity = rand_range(-max_angular_speed, max_angular_speed)


func _on_VisibilityNotifier2D_screen_exited():
	die()


func _on_Spawner_reset():
	die()


func die():
	queue_free()
