- Joined
- Apr 25, 2018
- Messages
- 9
- Reaction score
- 2
- First Language
- English
- Primarily Uses
- RMMV
Hey, been looking through the posts here and had a question concerning QMovement and diagonal directions.
I've been using QMovement and CollisionMap for a project, but was wondering if I could adjust the diagonal directions from 45 degrees to 22.5 degrees to accommodate certain isometric maps.
Below is an example of the kind of isometric map I was trying to accommodate:

Main difference from conventional isometric maps is the lower "slope" of the diagonal lines; the movement in the above game also handles diagonal movement on a lower "slope". (Slope like diagonal movement at, instead of a 45 degree angle, a 22.5 degree angle)
Things I tried to replicate this include changing how diagonal directions are defined in QPlus.
Looking through this thread, I found this snippet that I think somewhat does that:
I changed the diagonal radian values in the directionToRadian function accordingly, and also tried changing degree values in the radianToDirection function; both don't seem to help with the intended effect.
Unless I'm misunderstanding that the radian values don't determine to what degree a diagonal direction faces, then I may have to look into how movement is updated next.
I appreciate any thoughts on this and hope this was clear enough.
I've been using QMovement and CollisionMap for a project, but was wondering if I could adjust the diagonal directions from 45 degrees to 22.5 degrees to accommodate certain isometric maps.
Below is an example of the kind of isometric map I was trying to accommodate:

Main difference from conventional isometric maps is the lower "slope" of the diagonal lines; the movement in the above game also handles diagonal movement on a lower "slope". (Slope like diagonal movement at, instead of a 45 degree angle, a 22.5 degree angle)
Things I tried to replicate this include changing how diagonal directions are defined in QPlus.
Looking through this thread, I found this snippet that I think somewhat does that:
Code:
Game_CharacterBase.prototype.directionToRadian = function(dir) {
dir = dir || this._direction;
if (dir === 2) return Math.PI / 2;
if (dir === 4) return Math.PI;
if (dir === 6) return 0;
if (dir === 8) return Math.PI * 3 / 2;
if (dir === 1) return Math.PI * 5 / 6;
if (dir === 3) return Math.PI / 6;
if (dir === 7) return Math.PI * 7 / 6;
if (dir === 9) return Math.PI * 5 / 3;
return 0;
};
Game_CharacterBase.prototype.radianToDirection = function(radian, useDiag) {
radian = QPlus.adjustRadian(radian);
if (useDiag) {
// use degrees for diagonals
// since I don't know clean PI numbers for these degrees
var deg = radian * 180 / Math.PI;
if (deg >= 22.5 && deg <= 67.5) {
return 3;
} else if (deg >= 112.5 && deg <= 157.5) {
return 1;
} else if (deg >= 202.5 && deg <= 247.5) {
return 7;
} else if (deg >= 292.5 && deg <= 337.5) {
return 9;
}
}
if (radian >= 0 && radian < Math.PI / 4) {
return 6;
} else if (radian >= Math.PI / 4 && radian < 3 * Math.PI / 4) {
return 2;
} else if (radian >= Math.PI * 3 / 4 && radian < Math.PI * 5 / 4) {
return 4;
} else if (radian >= Math.PI * 5 / 4 && radian < Math.PI * 7 / 4) {
return 8;
} else if (radian >= Math.PI * 7 / 4) {
return 6;
}
};
Unless I'm misunderstanding that the radian values don't determine to what degree a diagonal direction faces, then I may have to look into how movement is updated next.
I appreciate any thoughts on this and hope this was clear enough.