Animating 2D movement

Godot Version

4.7

Question

How do you usually move a character around with animations in a 2D game? I'm working on a platformer, and some attacks would have movement in them like an uppercut or something like that. If I want something more specific that wouldn't be possible or just hard using physics, what other options do I have? I know about root motion in 3D but I've never seen anything like it for 2D. Any help is appreciated.

AnimatedSprite2D Node I’m pretty sure. I’m not very good with script but you have to use play and stop or something like that and also make sure sprite frames are more than 0 FPS so It actually plays. Sorry I’m new to using Godot

Can you be more specific on what you’re using now?

CharacterBody2D?

Yes. CharacterBody2D with an Animation Player.

If you do not invoke move_and_slide() you do not apply physics, giving your own script code full control over what the CharacterBody2D does.

So in pseudo code

func _physics_process(delta : float) -> void:
  if doing_uppercut:
    return handle_uppercut()
  # do your usual stuff
  move_and_slide()