extends Node2D

export var start = Vector2()
export var end = Vector2()
export var moving = true
export var falling = false
export(int, "linear", "sine", "quint", "quart", "quad", "expo", "elastic", "cubic", "circ", "bounce", "back") var trans
export(int, "in", "out", "in_out", "out_in") var eases
export(int) var speed = 0

#var modes = ["move", "color", "scale", "rotate", "callback", "follow", "repeat", "pause"]
var accum = 0.0
var fall

onready var tween =  get_node("Tween")

func _fixed_process(delta):
	accum += delta * 0.1 * speed
	accum = fmod(accum, 1)
	var runtime = tween.get_runtime()
	tween.seek(runtime * accum)
	if fall:
		pass

func _ready():
	tween.set_tween_process_mode(Tween.TWEEN_PROCESS_IDLE)
	tween.interpolate_method(get_node("body"), "set_global_pos", start, end, 2, trans, eases)
	tween.interpolate_method(get_node("body"), "set_global_pos", end, start, 2, trans, eases, 2)
	set_fixed_process(true)
