0 votes

I know there are questions asking for similar but I think this is more specific.

I have a player node with its own script and other node (wich is a boomerang) with its own script too. So when i press the mouse click button, the boomerang script will execute (throwing the boomerang until it comes back to its start position) and at the same time, the player script will reproduce "throw" animation.
The problem is that the boomerang will come out at time 0 of the player's "throw" animation and I want it on 0.2
I know that there's method calls for animations, but I don't know how to apply them on this certain case where are two different scripts for each node.

Maybe using a timer is right what i want, but I'm not sure.

Other thing I want to do is that player can't execute "throw" animation if boomerang is flying

Thanks in advance.

Godot version Godot v. 3.3
in Engine by (18 points)

1 Answer

+1 vote
Best answer

In the player's throw animation, after 0.2 seconds call the function that moves the boomerang. AnimationPlayers can work on multiple nodes at once.

by (7,190 points)
selected by

Thank you! That worked to match the animation!
Now, do you have any idea of how can I make that player can't execute "throw" animation and make the boomerang can't launch if the boomerang is flying? (so as not have more than one boomerang in air)

You can set a boolean value on the player. When the player tries to throw a boomerang, if can_throw is true, start the animation and set it to false. Else, don't. And when the boomerang returns you should set it to true.

Hi! thanks for your answer! I think I've already done that, but I'm not sure if It's ok..
Maybe some images will help to better show what I've done

Boomerang script
https://drive.google.com/file/d/15opyvP46SeimFL8Kzzh-WD0WpA7YJIlt/view?usp=sharing

Player script
https://drive.google.com/file/d/1pPo06vgrqT3QOIkl1_K298bKwwJfn9i2/view?usp=sharing

scenes
https://drive.google.com/file/d/1JePuX9dxI3PKnJSeybFdJFFozhppoteI/view?usp=sharing

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 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 webmaster@godotengine.org with your username.