Hello! In short, I am wanting to find the closest tile to the current position of the mouse. I found this thread here:
https://forums.rpgmakerweb.com/index.php?threads/mouse-cursor-position.95309/
Specifically this post:
But I'm not quite sure how to implement this code for what I need.
I need: When player clicks, get the closest tile position's x and y (and store it to variable)
Based on this post, do I just add something like this in a blank .js file?
document.addEventListener('mousedown', getMousePosition);
function getMousePosition(e) {
var x = Graphics.pageToCanvasX(e.pageX);
var y = Graphics.pageToCanvasY(e.pageY);
}
I'm sure this is wrong. Could someone please help me out? Thank you!
https://forums.rpgmakerweb.com/index.php?threads/mouse-cursor-position.95309/
Specifically this post:
But I'm not quite sure how to implement this code for what I need.
I need: When player clicks, get the closest tile position's x and y (and store it to variable)
Based on this post, do I just add something like this in a blank .js file?
document.addEventListener('mousedown', getMousePosition);
function getMousePosition(e) {
var x = Graphics.pageToCanvasX(e.pageX);
var y = Graphics.pageToCanvasY(e.pageY);
}
I'm sure this is wrong. Could someone please help me out? Thank you!