MZ Best way to go about having a group of pictures that change when the mouse cursor hovers over them?

I'll try explain as best I can. Basically I have 10 images that appear on the screen. I also have "lit-up" versions of each picture that I want to appear in their place whenever the mouse cursor is hovered over it. Then of course you would select a picture and something would happen. Think of it as like a character select screen in old fighting games (Street fighter 2 for example).

My current idea is to get a plugin that stores the cursor's position on the map to variables and then have conditional branches that check if the mouse cursor's cordinates match specific numbers. So something like, "if cursor X position = 10 and cursor y position = 20 then display picture 3"

Is this the best way to go about this or is there a better way? Any advice would be greatly appreciated 🙂
I think this tutorial might help you. I demonstrated using the script to show a picture of text, but the same principle applies with just changing/updating an image.

I hope this helps.

That would be the best way to do it if you want the images to light up. Unless you got a if cursor is clicking feature, you might need to find a plugin so whenever the you click on the image it'll run a common event.
If you can't find a plugin for that, here is one that I found: https://forums.rpgmakerweb.com/index.php?threads/button-picture-update.142058/
It won't have lit up images, but it allows you to set up a common event for once they click on it.

Edit: You also can check out ZombieKidzRule's video, if you rather use scripts instead.
You might not want to check using exact x/y Cords, it's bound to be brittle.

I would suggest creating Hitboxes, which are essentially a range of positions instead.

You technically could do this using events, although it would be extremely tedious.

Something like this: -
const x = $gameScreen.picture(3).x();
const y = $gameScreen.picture(3).y();
const sx = $gameScreen.picture(3).scaleX() / 100;
const sy = $gameScreen.picture(3).scaleY() / 100;
const bmp = ImageManager.loadPicture("Char3_Base"); // or use the lit name if that’s loaded
const w = bmp.width * sx;
const h = bmp.height * sy;
const mx = TouchInput.x;
const my = TouchInput.y;
mx >= x && mx <= x + w && my >= y && my <= y + h

Otherwise, creating or using a lightweight plugin would be best.
I think this tutorial might help you. I demonstrated using the script to show a picture of text, but the same principle applies with just changing/updating an image.

I hope this helps.


Amazing! Thank you so so much. It works great! ^-^

Original thread: https://forums.rpgmakerweb.com/threads/best-way-to-go-about-having-a-group-of-pictures-that-change-when-the-mouse-cursor-hovers-over-them.179820/