AnimationPlayer A need to change to different animation B at same frame.

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

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 !

:bust_in_silhouette: Reply From: MintSoda
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.

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

quizzcode | 2021-09-02 22:10