extends State

export (NodePath) var idle_node

onready var idle_state: State = get_node(idle_node)

func enter(state_modifiers: Array = []) -> void:
	.enter()
	parent.velocity.x = 0
	parent.set_hurtbox(false)
	state_timeout = Timer.new()
	state_timeout.wait_time = 1.0
	state_timeout.one_shot = true
	state_timeout.autostart = true
	add_child(state_timeout)

func process_frame(delta: float) -> State:
#	move_component.wants_jump() 
	move_component.get_movement_direction()
	if state_timeout.time_left == 0:
		return idle_state
	return null


func process_physics(delta: float) -> State:
	parent.velocity.y += gravity * delta
	#parent.velocity = parent.move_and_slide(parent.velocity, Vector2(0, -1))
	if (parent.direction.x > 0):
		parent.velocity.x = 1 * move_speed
	else:
		parent.velocity.x = -1 * move_speed
	parent.velocity = parent.move_and_slide(parent.velocity, Vector2(0, -1))

	return null
