Yes, you're right. I'm sorry I got carried away..
So, how did I solve it :
Is used the advice of p7r and used signals instead, so, my code looks like that now :
onready var active_character
var mobs = get_mobs()
for mob in mobs:
active_character = get_child(0)
static func sort_mobs(a, b):
return a.speed > b.speed
var new_index : int = (active_character.get_index() + 1) % get_child_count()
active_character = get_child(new_index)
Now here is the solution : On your active_character, you need to create a signal using
After that, in your play_turn() function inside of your actual character, you need to make him take his turn (creating a scene with some buttons that you can load and use for exemple), and THEN use
When you figure out how to use the yield function, it becomes quite handful, especially for scenarios when you need to wait for your player to take a choice.