diff options
author | Henrique Alves <henriquelalves@gmail.com> | 2022-07-15 22:17:25 -0300 |
---|---|---|
committer | Henrique Alves <henriquelalves@gmail.com> | 2022-07-15 22:17:25 -0300 |
commit | a5379c8d67345722424f550647c7ffa60b415eff (patch) | |
tree | c5d2b5a30d1194478ae0c7c7e3f492654e47d9bb | |
parent | acc128d1ade29f9f7492d9124ed63e26b3f4ecad (diff) | |
download | gamejam-gmtk-2022-a5379c8d67345722424f550647c7ffa60b415eff.tar.gz gamejam-gmtk-2022-a5379c8d67345722424f550647c7ffa60b415eff.tar.bz2 gamejam-gmtk-2022-a5379c8d67345722424f550647c7ffa60b415eff.zip |
Entity.gd
-rw-r--r-- | Scenes/Entity.gd | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/Scenes/Entity.gd b/Scenes/Entity.gd new file mode 100644 index 0000000..5eeffde --- /dev/null +++ b/Scenes/Entity.gd @@ -0,0 +1,32 @@ +extends Spatial + +class_name Entity + +export(bool) var actionable + +var actions_queue : Array = [] + +func _ready(): + if actionable: add_to_group("actionables") + +func play_actions(): + while actions_queue.size() > 0: + var action = actions_queue[0] # action => [ "cor_name", X ] + yield(call(action[0], action[1]), "completed") + actions_queue.pop_front() + +func cor_move_entity(args : Array): # args = [Vector3] + var new_pos = args[0] + + var finished = false + + while not finished: + var cur_pos = translation + var delta = get_process_delta_time() + translation = lerp(cur_pos, new_pos, delta * 14) + + if abs((cur_pos - new_pos).length()) <= 10e-3: + translation = new_pos + finished = true + + yield(get_tree(),"idle_frame") |