Moving a picture around using mouse or keyboard (MZ)

I'm trying to get a picture to move around using the arrow-keys or using the mouse (click-and-drag).
I know you can do this via the 'move picture' event.. but that only allows you to move it along a specified path.

Is there a way, or a plugin for MZ, that allows you to move a picture using the arrow-keys, or the mouse?
So let me start by saying I am not the most experienced person to offer advice, I can’t test this right now, and it depends on what you want it to look like in the game when it moves, but here is the first thing I would try through eventing.

I would use the Event Command option for if a certain button is being pressed through Conditional Branches and depending on which button is being pressed, that would erase the picture and put it back on the next tile in the appropriate direction using Variables.

You would store the X and Y location of the initial picture placement in 2 Variables. Then, by moving one tile in any direction, you are either adding or subtracting 1 from the X and/or Y Variable, as appropriate.

So, you have the X and Y location of the starting picture. The player pushes a button that tells the Event the picture should move one tile up. So you leave the X Variable the same and subtract 1 from the Y Variable. Then you use the new values of the Variables to Show Picture again in the new location.

Now, I don’t think that will have a smooth moving appearance and there are some things you would have to account for when the player wants to move in a direction they can’t.

But that is what I would test first if I wanted to try this.

Hopefully someone else will have a better and more elegant suggestion with Eventing or a Plugin.

I hope that helps a little!
For mouse movement keep in mind that not only do you have to factor in TouchInput's x and y properties, but also the acceleration of the mouse movement, in order to accurately track where the picture is moving in relation to the mouse.
So let me start by saying I am not the most experienced person to offer advice, I can’t test this right now, and it depends on what you want it to look like in the game when it moves, but here is the first thing I would try through eventing.

I would use the Event Command option for if a certain button is being pressed through Conditional Branches and depending on which button is being pressed, that would erase the picture and put it back on the next tile in the appropriate direction using Variables.

You would store the X and Y location of the initial picture placement in 2 Variables. Then, by moving one tile in any direction, you are either adding or subtracting 1 from the X and/or Y Variable, as appropriate.

So, you have the X and Y location of the starting picture. The player pushes a button that tells the Event the picture should move one tile up. So you leave the X Variable the same and subtract 1 from the Y Variable. Then you use the new values of the Variables to Show Picture again in the new location.

Now, I don’t think that will have a smooth moving appearance and there are some things you would have to account for when the player wants to move in a direction they can’t.

But that is what I would test first if I wanted to try this.

Hopefully someone else will have a better and more elegant suggestion with Eventing or a Plugin.

I hope that helps a little!
I tried this one, but i must've done something wrong cause it does not work.

Anyways, i found another way to get what i wanted. Not the most elegant solution, but it works just fine. Thanks though 🙂
So, I just messed around with this and it definitely didn't work like I thought it would. However, with a little tweaking and experimenting, I was able to move a picture smoothly in any direction, including diagonally.

I'm not sure if this is what you were looking for and there are still probably some kinks that need to be worked out, but I think this demonstrates the concept.

Here is a quick video of it in action along with a quick look at the Events. I didn't use any sound because I wasn't in a quiet place when I just made this.

I hope this helps and I certainly learned something new from trying this out!

So, I just messed around with this and it definitely didn't work like I thought it would. However, with a little tweaking and experimenting, I was able to move a picture smoothly in any direction, including diagonally.

I'm not sure if this is what you were looking for and there are still probably some kinks that need to be worked out, but I think this demonstrates the concept.

Here is a quick video of it in action along with a quick look at the Events. I didn't use any sound because I wasn't in a quiet place when I just made this.

I hope this helps and I certainly learned something new from trying this out!


That actually does help me out.
Not for what i need right now, but for future reference this is actually quite handy.
Saving this for later. Thanks a lot for this!
That actually does help me out.
Not for what i need right now, but for future reference this is actually quite handy.
Saving this for later. Thanks a lot for this!
Glad it helped! And I am really glad that I wasn't completely off base with what I was thinking. But I definitely wasn't on base either. I was sort of somewhere in between and I am glad I tried making this work because I will definitely be able to use this in the future.

Good luck!

Original thread: https://forums.rpgmakerweb.com/threads/moving-a-picture-around-using-mouse-or-keyboard-mz.153789/