extends "res://src/templates/Actor/states/idle.gd"


var debugTimeTracker := 0.0

export (NodePath) var wander_node
export (NodePath) var attack_node

onready var wander_state: State = get_node(wander_node)
onready var attack_state: State = get_node(attack_node)

func enter() -> void:
	.enter()
	parent.set_hurtbox(true)
	parent.velocity.x = 0
	state_timeout.start()

func process_frame(_delta: float) -> State:#	if get_jump() and parent.is_on_floor():
#		return jump_state

	if state_timeout.time_left == 0:
		return wander_state
		
#	move_component.wants_jump() 
	move_component.get_movement_direction()

#	if Input.is_action_just_pressed('dash'):
#		return dash_state
	return null

func process_physics(delta: float) -> State:
	debugTimeTracker += delta
	if debugTimeTracker > 2:
		debugTimeTracker = 0.0
		print("DEBUG TRANSFORM:", parent.transform)

	parent.velocity.y += gravity * delta
	#parent.velocity = parent.move_and_slide(parent.velocity, Vector2(0, -1))
	parent.velocity.x = move_component.desired_movement_vector.x * move_speed
	parent.velocity = parent.move_and_slide(parent.velocity, Vector2(0, -1))

	
	if !parent.is_on_floor():
		return fall_state
	return null
