Right now the last entered direction is retained. The issue appears when the player wants to choose a diagonal direction and release buttons. Unless both buttons are released in the same frame, there is a short time when only one cardinal direction is pressed. That causes a change in direction to the second button released.
To change that, perhaps a 3-4 frames of delay needs to be added. If we go from a diagonal direction to no input, we should retain the last diagonal direction.
Right now the last entered direction is retained. The issue appears when the player wants to choose a diagonal direction and release buttons. Unless both buttons are released in the same frame, there is a short time when only one cardinal direction is pressed. That causes a change in direction to the second button released.
To change that, perhaps a 3-4 frames of delay needs to be added. If we go from a diagonal direction to no input, we should retain the last diagonal direction.