class_name PlayerWalkState extends PlayerState func enter(_msg := {}): player.play_walk_animation() func physics_update(delta): var direction = player.get_input_direction() var velocity = direction * player.speed player.flip_sprite() var collision = player.move_and_collide(velocity * delta) if collision and Input.is_action_pressed("hit"): state_machine.transition_to("HitBall") if velocity == Vector2.ZERO: state_machine.transition_to("Idle")