Input.dir4 and Input.dir8 problems

I want to make the sprites move diagonally when you press the keys, but it just moves weirdly. Can someone spot why?

My code:

Spoiler
Code:
Game_Player.prototype.moveByInput = function() {    if (!this.isMoving()) {        return;    }    if ($gameMap._interpreter.isRunning()) {        return;    }    switch(Input.dir8) {        case 2:            this.moveStraight(Input.dir4);            break;        case 4:            this.moveStraight(Input.dir4);            break;        case 6:            this.moveStraight(Input.dir4);            break;        case 8:            this.moveStraight(Input.dir4);            break;        case 1:            this.moveDiagonally(4, 2);            break;        case 3:            this.moveDiagonally(6, 2);            break;        case 5:            this.moveDiagonally(4, 8);            break;        case 7:            this.moveDiagonally(6, 8);            break;                                                                }}; 

Original thread: https://forums.rpgmakerweb.com/threads/input-dir4-and-input-dir8-problems.48845/