For 2D, you need animation tracks that line up with each other, and when you switch from one to the other say from walking to shooting, you need to make sure you are at the same time in the new animation as you were in the old animation. You can do this in Godot via the AnimationTree. The BlendTree and the StateMachine are both capable of doing this.
You can also do this using the simpler AnimationPlayer by setting the time yourself using seek()
. Here is a small example you can drop in a project: