extends CharacterBody2D

var frisbee = preload("res://frisbee.tscn")

var heldFrisbee :CharacterBody2D= null

var remote_player :bool= false

var max_walk :float= 10
var accel_walk :float= 100

var max_run :float= 20
var accel_run :float= 2 * accel_walk

var friction_tonic :float= 1e-1

var move_dir :Vector2= Vector2.ZERO

# Called when the node enters the scene tree for the first time.
func _ready():
	pass

func set_move_direction(dir):
	move_dir = dir

func move_player(delta):
	move_and_collide(move_dir * max_walk)

# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
	move_player(delta)

func _input(event):
	if remote_player:
		pass
	
	var direction = Input.get_vector(
		"player_left",
		"player_right",
		"player_up",
		"player_down"
	)
	set_move_direction(direction)
	
	var flick = Input.get_vector(
		"flick_left",
		"flick_right",
		"flick_up",
		"flick_down"
	)
	
	var flick_rot :float= 0
	if flick.length_squared() != 0:
		flick_rot = flick.angle() - PI/8*3
	
	$LeftArm.rotation = flick_rot
	$RightArm.rotation = flick_rot
