I Would recommend you make it so when the character stops moving they keep attacking in the direction they were moving instead of the direction going to the right.