Oi~ I've been working on creating a 16 directional movement system today, I've got it to work somewhat, however I seem to be having a bit of trouble with one issue, and I can't seem to figure it out, I'd done something similar with a previous version of rpg maker, however I've been scratching my head trying to making this one work, so here's what I've got right now.
this code works, the player moves in the right directions, the only problem is the new directions should be moving like this.
however, everytime I use one of the new movements, it moves like this.
I can't seem to find where the math of how the movements are defined, so I'm not sure where I should apply anything.
P.S. I'm using a pixel movement script, with each tile cut into sixth's found here http://forums.rpgmakerweb.com/index.php?/topic/46493-super-orange-movement-pixel-movement-with-custom-features/
any help/advice is welcome thanks in advance~
JavaScript:
Game_CharacterBase.prototype.movedir = function(direction) {
switch(direction) {
case 0.5 :
xPlus = -2;
yPlus = 1;
case 1 :
xPlus = -1;
yPlus = 1;
break;
case 1.5 :
xPlus = -1;
yPlus = 2;
break;
case 2 :
yPlus = 1;
xPlus = 0;
break;
case 2.5 :
yPlus = 1;
xPlus = 2;
break;
case 3 :
yPlus = 1;
xPlus = 1;
break;
case 3.5 :
yPlus = 2;
xPlus = 1;
break;
case 4 :
xPlus = 1;
yPlus = 0;
break;
case 6 :
xPlus = -1;
yPlus = 0;
break;
case 6.5 :
xPlus = -1;
yPlus = -2;
break;
case 7 :
xPlus = -1;
yPlus = -1;
break;
case 7.5 :
xPlus = -1;
yPlus = -2;
break;
case 8 :
xPlus = 0;
yPlus = -1;
break;
case 8.5 :
yPlus = -1;
xPlus = 2;
break;
case 9 :
yPlus = -1;
xPlus = 1;
break;
case 9.5 :
yPlus = -2;
xPlus = 1;
break;
default :
xPlus = 0;
yPlus = 0;
break;
}
this._x += xPlus;
this._y += yPlus;
};
this code works, the player moves in the right directions, the only problem is the new directions should be moving like this.

however, everytime I use one of the new movements, it moves like this.

I can't seem to find where the math of how the movements are defined, so I'm not sure where I should apply anything.
P.S. I'm using a pixel movement script, with each tile cut into sixth's found here http://forums.rpgmakerweb.com/index.php?/topic/46493-super-orange-movement-pixel-movement-with-custom-features/
any help/advice is welcome thanks in advance~
Last edited: