never mind I came out with a aimple solution. If anyone wanna know:
I created a dir8 variable that holds the 8 direction number:
In Game_CharacterBase.prototype.updateMove i call the change of the value based upon the current character movement if the direction isn't fixed
in Game_CharacterBase.prototype.setImage ,when given the image file, checks if the image has "dir8" in the name, in that case sets this._isDir8 (which i created) true
Basically from now on if the character is a dir8 cahracter (_dir8 is true) and it faces in the 4 basic directions it sets the index of the graphic (the character u choose upon the 8 when u give the graphic) as the original index, instead if he faces a diagonal direction it sets the index to the original index + 4 and basically it chooses the character below, which holds the graphic of the character facing the diagonal directions.
I hope it's not too gibberish and someone will find this usefull
below is an example of the sprite i'm using for testing:
EDIT: I changed the code to make it clean
var alias_Game_CharacterBase_initMembers = Game_CharacterBase.prototype.initMembers;
Game_CharacterBase.prototype.initMembers = function() {
alias_Game_CharacterBase_initMembers.call(this); //calls original method
this._dir8 = this._direction;
this._isDir8 = false;
};
var alias_CharacterBase_update = Game_CharacterBase.prototype.update
Game_CharacterBase.prototype.update = function() {
alias_CharacterBase_update.call(this); //calls original method
// added lines
this.updateDir8();
};
Game_CharacterBase.prototype.setImage = function(characterName, characterIndex) {
this._tileId = 0;
this._characterName = characterName;
this._characterIndex = characterIndex;
this._isObjectCharacter = ImageManager.isObjectCharacter(characterName);
// added lines
this._isDir8 = ImageManager.is8DirCharacter(characterName);
this._originalCharacterIndex = (this._isDir8 && this._characterIndex > 3) ? this._characterIndex - 4 : this._characterIndex;
};
Game_CharacterBase.prototype.setDirection = function(d) {
if (!this.isDirectionFixed() && d) {
var dir4;
switch (d) {
case 1:
dir4 = 2;
break;
case 3:
dir4 = 6;
break;
case 7:
dir4 = 4;
break;
case 9:
dir4 = 8;
break;
default:
dir4 = d;
}
this._direction = dir4;
this._dir8 = d;
}
this.resetStopCount();
};
Game_CharacterBase.prototype.updateDir8 = function() {
if (this._isDir8) {
if (Math.isEven(this._dir8)) {
// direzione a croce
this._characterIndex = this._originalCharacterIndex;
}
else {
// direzione in diagonale
this._characterIndex = this._originalCharacterIndex + 4;
}
}
};
Game_CharacterBase.prototype.moveDiagonally = function(horz, vert) {
this.setMovementSuccess(this.canPassDiagonally(this._x, this._y, horz, vert));
if (this.isMovementSucceeded()) {
this._x = $gameMap.roundXWithDirection(this._x, horz);
this._y = $gameMap.roundYWithDirection(this._y, vert);
this._realX = $gameMap.xWithDirection(this._x, this.reverseDir(horz));
this._realY = $gameMap.yWithDirection(this._y, this.reverseDir(vert));
this.increaseSteps();
}
if (horz == 4) {
if (vert == 2) this.setDirection(1);
else this.setDirection(7);
} else {
if (vert == 2) this.setDirection(3);
else this.setDirection(9);
}
};
basically all you after implementing this code is to add "8dir" to the name of the file (wherever you want) and put the diagonal movement graphics right below the standard one, as if they where the graphics of another character. At this point you can choose either one when assigning the graphic.