I don’t know why you are using "On Pressed A and D" — perhaps you are creating some other function. However, the reason why your character moves left with its face facing right when you press A, then D, and release D is that the last key you pressed was "D." The `onPressed` function executes immediately upon pressing a key, so after pressing A and then pressing D, the `mirror` function for A will be overridden by D, and vice versa.
However, for the down function, if A and D are pressed simultaneously, the character will not move because one is moving right and the other is moving left. But when you release D, the character will walk because of the key A, although the appearance will still not be mirrored due to the last pressed key being D.
Initial state: Mirror - Not WALK
Press A: Mirror(onPressed) - WALK to Left(KeyDown A)
Press D: NotMirror(onPressed) - NOT WALK (because walk to left and right) (KeyDown A and KeyDown D)
Release D: Still NotMirror (because the last onPressed is D) - Walk to left (because keydown remains A)
So your character will face right (NotMirror) because your last pressed key was D.
This is my simple solution.