0 votes

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.

Godot version 3.2.3
in Engine by (44 points)

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

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.