[RMMZ] NoR_PD_MenuSlide_MZ [Ver 1.0] (Original Author: Shio_inu/PixelDOG) (Editor: NoR)
Disclaimer
I (NoR) AM NOT the original author (Shio_inu / PixelDOG), nor do I claim to be! I'm just someone who made the original plugin compatible with MZ with added features. My edit is in line with the original author's Terms of Use (found in the "Original Plugin Download Contents" folder of the attached .zip file. Or you can view it for yourself from the source: https://forums.rpgmakerweb.com/index.php?threads/sliding-menu-animation-tween.101250/), which states their plugin can be up for "redistribution after modification." As of update Ver 1.0, I have only made meaningful, original code alterations to the original author's "PD_MenuSlide.js" plugin. I have not touched the "PD_TweenAnimation.js" aside from adding a @target MZ so that the original author's name can be displayed in the plugin list.
Blog-like Ramble
I am not a UI person. Nor am I a JS person. My reaction when I realised I needed to use JS to make a more personal, customised UI? "Pfft, forget it." You can imagine my brain pain when it came to spicing up my menu. It wasn't until I played a WOLF RPG game that had menu animations. It was very, VERY simple. But I really appreciated how it looked. The pause menu slid in when opening it and slid out when closing it. It was there I decided to implement that in my project. So, I went searching and found a plugin with EXACTLY what I needed...for MV. I tried to run it with FOSSIL but I had some issues. So like the stubborn person I am, I put on my big person pants on and decided to fix PD_MenuSlide myself. It took me a night & my fixation to get through it, but I did it! I even added a new feature. It was really frustrating but fun and satisfying to look into things, figure things out & solve them! I present to you: the fruits of my labour!
I am not a UI person. Nor am I a JS person. My reaction when I realised I needed to use JS to make a more personal, customised UI? "Pfft, forget it." You can imagine my brain pain when it came to spicing up my menu. It wasn't until I played a WOLF RPG game that had menu animations. It was very, VERY simple. But I really appreciated how it looked. The pause menu slid in when opening it and slid out when closing it. It was there I decided to implement that in my project. So, I went searching and found a plugin with EXACTLY what I needed...for MV. I tried to run it with FOSSIL but I had some issues. So like the stubborn person I am, I put on my big person pants on and decided to fix PD_MenuSlide myself. It took me a night & my fixation to get through it, but I did it! I even added a new feature. It was really frustrating but fun and satisfying to look into things, figure things out & solve them! I present to you: the fruits of my labour!
Introduction
NoR's PD_MenuSlide for MZ allows you to change the initial position of the command, gold & status windows of the main/pause menu. You can also animate how they enter and exit the screen.
Features
* Plugin's default animation is a slide in & slide out that is made for MZ's default menu layout . If you need it to fit your custom menu, you must go into an IDE of your choice with the plugin and change certain numbers yourself.
* Animated main menu open (Command, Status & Gold window sliding in)
* Animated main menu close (Command, Status & Gold window sliding out)
* Customisation of both closing/opening animations.
* ***Compatible with Visustella's Core & Menu Core plugins
Screenshots
How to Use
- Download .zip file attached to this post
- Extract the contents
- Drag and drop NoR_PD_MenuSlide_MZ.js & PD_TweenAnimation.js in your plugins folder (...\RMMZ\[Your Project's Name]\js\plugins).
- Order NoR_PD_MenuSlide_MZ.js before PD_TweenAnimation.js, put them both under all your other plugins.
- Tweak animations as needed by opening NoR_PD_MenuSlide_MZ.js in an IDE of your choice. Your animations are not customised in PD_TweenAnimation.js, leave it alone. Only touch PD_TweenAnimation.js if you want to add new features.
How to tweak the animations
There are no plugin parameters, script calls or plugin commands. I may add them in the future if someone suggests something and if I can do it, but right now, you can only adjust your animations by editing NoR_PD_MenuSlide_MZ in an IDE of your choice.
While this looks intimidating, it isn't. QueueTweenAnimation comes from the partner plugin "PD_TweenAnimation.js". We'll dissect the first instance of its usage in this plugin as our example:
this._commandWindow.addAnimation(new QueueTweenAnimation(new Point(Graphics.boxWidth - this.mainCommandWidth(), this.mainAreaTop), new Point(1.0, 1.0), 0, 10, 2, 0));
this._commandWindow.addAnimation(new QueueTweenAnimation(new Point(Graphics.boxWidth - this.mainCommandWidth(), this.mainAreaTop), new Point(1.0, 1.0), 0, 10, 2, 0));
- this._commandWindow (The window affected. In this case, it's the command window object within the Scene_Menu instance that will get the animation. To change the gold window animation, start with this._goldWindow. To change the status window animation, start with this._statusWindow )
- .addAnimation() (The function defined in "PD_TweenAnimation.js". It adds a new animation to our ._commandWindow object, AKA: the command window.)
- new QueueTweenAnimation() (This creates a new instance from the "QueueTweenAnimation" class in "PD_TweenAnimation.js". This lets us customise the animation.)
- new Point(Graphics.boxWidth - this.mainCommandWidth()... (The window's final X destination on screen. We subtract the width of command window from the width of the game screen to position the command window on the right edge of the screen by the end of the animation. You may use negative values.)
- ..., this.mainAreaTop()) (The window's final Y destination on screen. this.mainAreaTop accounts for whether or not you have the help window on. this will posistition the window at the highest possible area, top edge of your screen or under the help window. You may use negative values.
- (Note! If you added UI Margins with Visustella Core Engine, you do NOT need to account for them by adding/subtracting numbers to the X & Y translations above! MZ & Core Engine will do it for you!)
- new Point(1.0, 1.0) (The scale of the animation. This means my animation is scaled by 1.0 on both X & Y axes. Which means it doesn't scale at all and will stay consistent and as I set it. Going above or below 1.0 will make the windows hard to read/use. I don't recommend doing anything beside 1.0 on the X axis and 1.0 on the Y axis but you may find a good use for it (like creating an animation where the window affected is scaled at 0.5 on both axes, then having the next animation change it to 1.0 scale on both axes, simulating a shrink to expand effect]. You may use negative & float values)
- 0 (This number rotates of the animation. Here, the rotation is set to 0, no rotation. Rotating your windows can obscure the text on them. This makes imporant information hard to read. Rotate wisely! You may use negative & float values.)
- 10 (This number sets the duration of the animation in frames. This animation will last 10 frames!)
- 2 (This number sets the easing curve type used for the animation. We are using 2, which is Ease Out. Here are the ONLY VALID INPUTS for cure type and what they do:
- Ease in and Out [CURVE_EASE_IN_OUT / 0]: animation starts slowly, accelerates in the middle, then slows down towards the end.
- Ease in [CURVE_EASE_IN / 1]: animation starts slowly, accelerates as it progresses.
- Ease out [CURVE_EASE_OUT / 2]: animation starts quickly and decelerates as it progresses.
- Uniform [UNIFORM / 3]: animation progresses at a constant speed throughout its entirety.
- It is possible to add your own curve type! But! You'll need to come up with the formula on your own.)
- 0 (This sets the coordinate type for the animation. We're using 0, which is the Absolute coordinate type. Here are the ONLY VALID INPUTS for coordinate type and what they do:
- Absolute (DST_ABSOLUTE / 0): destination position is specified in relation to the origin (0,0). This means your window's animation translation will finish at the exact XY coordinates you type.
- Relative (DST_RELATIVE / 1): destination position is specified relative to the object's current position. This means if your window starts at (10, 10) and you typed (50, 50) for your XY coordinates, your window's animation translation will finish at (60, 60) because (50 + 10 = 60, 50 + 10 = 60). The final position of your window is relative to its starting point!
I've explained where the windows will move and stop at. But where do they start? In any Scene_Menu.prototype.[Window Type]WindowRect, there are 4 constant variables (const): ww (window width), wh (window height), wx (window's x position), and wy (window's y position). These bear importance because in-game, these constants dictate how your windows look like when you open the menu. The plugin's default animation relies on changing these values since to slide in, the windows need to be off screen first. Which means, you need to change certain values to put the windows off screen. To choose your window's position before your animation plays, you will need to modify wx and wy. In the code below, you can see that windows' initial positions are shifted. The command window is shifted on the y axis by -600, the gold window is shifted on the x axis by +240, and the status window is shifted on the x axis by -950. These shifts put the windows' initial position off the screen. Combined with the function QueueTweenAnimation, creates the effect of the window sliding in to view from off screen. Here are some important notes about window positions:
The origin/absolute reference point is (0, 0), the top left of the screen
For Y VALUES, NEGATIVE numbers shift your windows UP. POSITIVE numbers shift your windows DOWN.
For X VALUES, NEGATIVE numbers shift your windows LEFT. POSITIVE numbers shift your windows RIGHT.
By default, the windows are on the right in MZ. If you set your windows to the left, you should set your initial window position on the right side of the colon in wx.
The origin/absolute reference point is (0, 0), the top left of the screen
For Y VALUES, NEGATIVE numbers shift your windows UP. POSITIVE numbers shift your windows DOWN.
For X VALUES, NEGATIVE numbers shift your windows LEFT. POSITIVE numbers shift your windows RIGHT.
By default, the windows are on the right in MZ. If you set your windows to the left, you should set your initial window position on the right side of the colon in wx.
Depending on the length of your animation, you may need to change the setTimeout surrounding SceneManager.pop(). setTimeout is there to let the closing animation play before exiting the scene. setTimeout is measured in milliseconds, so keep that in mind when changing the number.
If there's anything else someone would like me to explain, I'd be more than happy to. If anyone wants clarification, for me to share more examples, or to just inquire about things related to the plugin, LMK! I'd be glad to explain new things and help solves issues!
Known Bugs
***Visustella Main Menu Core allows for a Time Played window, Variable windows, & Core Engine creates a Help window. I have not figured our how to animate those. I want to fix that, but no promises because I know Visustella's code is obfuscated. If you know how to do it, please share! There is also a minor inconvenience bug with Visustella's subcategory option in their Menu Core plugin. When pressing back after clicking a sub-menu, it will exit out the whole menu an send you back to the map instead of going back to the base of the menu. It doesn't crash the game, but its slightly annoying. I tried to do commandWindow.setHandler("subcategory", this.commandPersonal.bind(this)); to stop this, but it didn't work. Again, I want to fix that, but no promises because I know Visustella's code is obfuscated. If you know how to do it, please share!
Download
- The bottom of the Version 1.15 Update post.
Terms and Credits
Again, all credit goes to the original author: Shio_inu/PixelDOG. They made both plugins "PD_TweenAnimation" and "PD_MenuSlide". As of Ver 1.0, I (NoR) have only made meaningful, original code alterations in "PD_MenuSlide". I have only touched "PD_TweenAnimation" to allow the original author's name to appear in the MZ plugin list. PD_TweenAnimation is entirely done by Shio_inu/PixelDOG, not me.
The original author's Terms of Use applies to both plugins:
OK for commercial use, mature content, modification, and redistribution after modification.
If you redistribute, please credit the original author: "Shio_inu" or "PixelDOG".
You can not sell this plugin on its own.
As of Ver 1.0, I've only provided original code in the plugin "NoR_PD_MenuSlide_MZ.js" MY Terms of Use ONLY APPLY TO NoR_PD_MenuSlide_MZ.js:
Do NOT credit me in any form. This means don't use my screen name, abbreviations of it, alternate versions, any links to me. No credit to me inside or outside your project.
If someone wants to know how you achieved something with this plugin, you may link them to the original post.
Not really a term of use, but if you have any suggestions, requests, questions, improvements, feedback: please let me know! If you make your own improvement/feature, tag me/message me/notify me and release it to the public so that others may use your feature(s) as well.