I am using multiple movement types in my game such as platformer and top down and someone here suggested to me to make a main script attached to my rigidbody2d that uses:
func _physics_process(delta: float) -> void:
current_state.run(delta)
and then I change the movement type by changing the current_state variable which is a Node2D.
This however has now gotten really messy, since I also have subtypes in some scripts for example I have a forced movement style where the player moves without input and I want to be able to make it for example follow nodes on a board, but also be able to turn that off and turn on a sequence of a few certain movements. Also running all of this code through a _physics_process doesn't seem logical for something like the sequence of a few certain movements since I'd rather just call it as a function instead once.
How could I clean this code up or go about doing this neater?
Thanks for the help in advance !