How do you write input based yield?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By John97

I’m trying to implement a turn queue. I want to right click, have one child node do something, right click again, and have the other child node do something. How do I do that? This is what I have so far. Parent node:

 func _ready():
	active_player = self.get_child(0)

func _input(event):
	if event.is_action_pressed("right_click"):

func play_turn():
	#yield(active_player.play_turn(), "completed") 
	var new_index : int = (active_player.get_index() + 1) % get_child_count()
	active_player = get_child(new_index)

Child node:

func _ready():
func play_turn():
    	yield(TurnQueue.play_turn(), "completed")

I’m getting and error in the child node: "Non-static function “play_turn” can only be called from an instance. The only guide I could find on turn queues doesn’t explain player input directed turn changes.

I got it to work with signals and taking out the yield.

John97 | 2021-04-20 21:28