extends CharacterBody2D
class_name Fish

@onready var sprite:Sprite2D = $Sprite2D
@export var speed = 300.0
@export var time_change = 2
@export var flip_v:bool = false

func _ready() -> void:
	$Timer.wait_time = time_change
	$Timer.start()
	$Sprite2D.flip_v = flip_v
	velocity = Vector2(speed, 0).rotated(get_rotation())

func _physics_process(_delta: float) -> void:
	move_and_slide()

func _on_timer_timeout() -> void:
	velocity = -velocity
	rotate(3.14)
	sprite.flip_v = !sprite.flip_v
