flip character sprite in set frame

Hi
I use only left rigth sprite and in fact left and rigth are just flip version
so I want to change set frame function to draw only one line of sprite and just flip it by code
Code:
Sprite_Character.prototype.updateCharacterFrame = function() {
    var pw = this.patternWidth();
    var ph = this.patternHeight();
    var sx = (this.characterBlockX() + this.characterPatternX()) * pw;
    var sy = (this.characterBlockY() + this.characterPatternY()) * ph;
    this.updateHalfBodySprites();
    if (this._bushDepth > 0) {
        var d = this._bushDepth;
        this._upperBody.setFrame(sx, sy, pw, ph - d);
        this._lowerBody.setFrame(sx, sy + ph - d, pw, d);
        this.setFrame(sx, sy, 0, ph);
    } else {
        this.setFrame(sx, sy, pw, ph);
    }
};
so I aim to this code and edit it to this

Code:
Sprite_Character.prototype.updateCharacterFrame = function() {
    var pw = this.patternWidth();
    var ph = this.patternHeight();
    var sx = (this.characterBlockX() + this.characterPatternX()) * pw;
    var sy = (this.characterBlockY() + this.characterPatternY()) * ph;
    
    if (this._isBigCharacter) {
        sy = 0;// < use only one/first line sprite frame
        ph = this.height;//< hieght of image
        var even = this._character;
        var d = even.direction();// - 2) / 2;
        var flip = 0;
        if(d === 4){
            //testtext(d)// < check if direction = right
            this.scale.x *= -1; //< flip the sprite
        }
        this.setFrame(sx, sy, pw, ph)
        return
    }


    this.updateHalfBodySprites();
    if (this._bushDepth > 0) {
        var d = this._bushDepth;
        this._upperBody.setFrame(sx, sy, pw, ph - d);
        this._lowerBody.setFrame(sx, sy + ph - d, pw, d);
        this.setFrame(sx, sy, 0, ph);
    } else {
        this.setFrame(sx, sy, pw, ph);
    }

};
The only one line use image had no problem
but the flipping sprite not work
I try mess up with many other area but no solution
any Idea?
thank you
you could use the original direction but set its x scale to be negative?
you could use the original direction but set its x scale to be negative?
yes... turn out it conflict with other plugin I use that override it
so it simple as that
thank you

Original thread: https://forums.rpgmakerweb.com/threads/flip-character-sprite-in-set-frame.118238/