0 votes

Alright. This tittle is confusing.

I have a tower, at 45 degree angle.
This tower has 8 animations named : N, NE, E, SE, S, SW, W, NW so that it can "aim/shoot" at the target.

The animations are all the same at 1.4s long and at 0.9 the method shoot() is called. (They just have different angles)

Problem is, I don't know how to change the animation from N to NE (enemy moving on it right) to the SAME frame of animation NE. So that the animation doesn't restart and delay shoot.

With animatedSprite i just needed to get the current frame and start from that frame.
But with animationPlayers I'm a little lost.

I rea about track and seek, but it still doesn't connect in my brain.
Any idea ? tutorial ?

Thanks !

Godot version 3+
in Engine by (184 points)

1 Answer

0 votes
Best answer
var cur_pos := anim_player.current_animation_position
anim_player.play("NE")
anim_player.seek(cur_pos)

Basically getting the current time and start from that time.

by (330 points)
selected by

Hey, thank you for your answer.
This looks like exactly what I need.
I will give it a shot. !

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.