set direction on move

Can someone tell me in which file, in which js handles the moving by arrow?


When you press right, the player will go to right. I've search the code 'right', 'left', 'up' even 'down' in scene_map but can't find it.


What i want to do is prevent the player from directing/facing to certain sprite. like when the player go down, I don't want the player to facing down.
Well I know what you mean but I suggest a different approach! What if instead of messing with the actual move input, you change something in the bit which sets the direction?


That bit would be:

Spoiler
Game_Player.prototype.getInputDirection = function() {
    return Input.dir4;
};


WHICH THEN LEADS TO THIS!


Game_Player.prototype.moveByInput = function() {
    if (!this.isMoving() && this.canMove()) {
        var direction = this.getInputDirection();
        if (direction > 0) {
            $gameTemp.clearDestination();
        } else if ($gameTemp.isDestinationValid()){
            var x = $gameTemp.destinationX();
            var y = $gameTemp.destinationY();
            direction = this.findDirectionTo(x, y);
        }
        if (direction > 0) {
            this.executeMove(direction);
        }
    }
};

Also the actual moving stuff goes on with this one! (this is what you actually asked for...)

Spoiler
Game_Player.prototype.executeMove = function(direction) {
    this.moveStraight(direction);
};





Also I know of two plugins that could help


THIS one or THIS one, both by the awesome Tsukihime!
Spoiler
Well I know what you mean but I suggest a different approach! What if instead of messing with the actual move input, you change something in the bit which sets the direction?


That bit would be:



  Hide contents



Game_Player.prototype.getInputDirection = function() {
    return Input.dir4;
};


WHICH THEN LEADS TO THIS!


Game_Player.prototype.moveByInput = function() {
    if (!this.isMoving() && this.canMove()) {
        var direction = this.getInputDirection();
        if (direction > 0) {
            $gameTemp.clearDestination();
        } else if ($gameTemp.isDestinationValid()){
            var x = $gameTemp.destinationX();
            var y = $gameTemp.destinationY();
            direction = this.findDirectionTo(x, y);
        }
        if (direction > 0) {
            this.executeMove(direction);
        }
    }
};
Also the actual moving stuff goes on with this one! (this is what you actually asked for...)

Spoiler
Game_Player.prototype.executeMove = function(direction) {
    this.moveStraight(direction);
};





Also I know of two plugins that could help


THIS one or THIS one, both by the awesome Tsukihime!




Thank you for executeMove function, because of that I figure it out myself 🙂  
Glad I could help!

Original thread: https://forums.rpgmakerweb.com/threads/set-direction-on-move.60000/