0 votes

I am making a classic beginners mistake I know. I just don't know what that mistake is! :-)
I want to trigger the computer's turn after X seconds. At present it's just too fast and I feel the player needs a bit of time to recover before the computer has its turn.

I have two functions. computersTurn() and playComputersTurn

playComputersTurn is where the real meat of the logic happens. The only reason I am using computersTurn() is to trigger playComputersTurn() after a delay. It may not be the best way but I'm only learning.

The real issue though, is getting it to work. Currently this is the code:

func computersTurn():
    tween.interpolate_callback(self, 1, "playComputersTurn()")
    tween.start()

You can see I'm trying to trigger the playComputersTurn() function after 1 second. But... It doesn't. It doesn't give an error, it just doesn't happen.

Can anyone offer advice as to what I'm doing wrong? Thanks a tonne...

in Engine by (838 points)

1 Answer

+1 vote
Best answer

slaps face into hands....

OK for future reference, remove the () from the function call.

IE:

func computersTurn():
    tween.interpolate_callback(self, 1, "playComputersTurn")
    tween.start()
by (838 points)
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.