The RPG Maker Resource Kit

RMRK RPG Maker Creation => XP => XP Scripts Database => Topic started by: Ryex on October 19, 2009, 03:59:12 AM

Title: [XP] Window_Advanced movement and more (scripting tool)
Post by: Ryex on October 19, 2009, 03:59:12 AM
Window_Advanced
Authors: Ryex
Version: 2.05
Type: Graphical Enhancement

Introduction

This is a base class like Window_Base, it contains methods for opening/closing windows with animation, as well as animated movement and resizing.


Features



Screenshots

http://www.youtube.com/watch?v=4sGvUk6uxL8


Demo

NA


Script


Spoiler for Window_Advanced_Base:
http://docs.google.com/View?id=dgb5wg25_11cbqt8vvz (http://docs.google.com/View?id=dgb5wg25_11cbqt8vvz)


Spoiler for Window_Advanced_Selectable :
http://docs.google.com/View?id=dgb5wg25_1288zn84d9 (http://docs.google.com/View?id=dgb5wg25_1288zn84d9)


Instructions

Spoiler for Instructions for both AdvBase and AdvSelectable:
to use simply subclass and add a finalize method and refresh method, use finalize to create the self.contents bitmap and call refresh to draw the content of the window, you can use it just like you would a normal window exsept you should NEVER create self.contents in def initialize the class has a special handling for this in def finalize.

moving? returns true if the window need moving
resizing? returns true if the window needs resizing
at_dest? returns true if the window needs neither moving nor resizing

move(x, y, mode, speed)
x > the x you want to move the window too
y > the y you want to move the window too
mode > 0 or 1 refers to the two different algorithms used for movement, default is 0
speed > the pixels the window will grow or shrink each frame should never be lower than 2, default is 2.
when mode is 1 speed works differently; when speed is 1 the window open instantly, when speed is 2 it open half the distance in the first frame half the remaining distance in the second and so on, when speed is 3 it open 30% of the remaining distance fist frame, 33.333% of the remaining distance the second and so on, when speed is 4 it moves 25% of the raining distence each frame, 5 it moves 20%, 6 > 16.666%, 7 > 14.2857%, ECT.

resize(w, h, mode, speed, pin)
w > new width
h > new height
mode > 0 or 1 refers to the two different algorithms used for resizing, default is 0
speed > the pixels the window will grow or shrink each frame should never be lower than 2, default is 2.
when mode is 1 speed works differently; when speed is 1 the window open instantly, when speed is 2 it open half the distance in the first frame half the remaining distance in the second and so on, when speed is 3 it open 30% of the remaining distance fist frame, 33.333% of the remaining distance the second and so on, when speed is 4 it moves 25% of the raining distence each frame, 5 it moves 20%, 6 > 16.666%, 7 > 14.2857%, ECT.
pin > should the top left corner be kept in the same place? true or false, default is false

NOTE: the resize method will call refresh when the window is done resizing

close(dir, mode, speed, pin)
dir > direction the window should close. o is top to bottom, 1 is left to right, 2 is both at the same time
mode > 0 or 1 refers to the two different algorithms used for resizing, default is 0
speed > the pixels the window will grow or shrink each frame should never be lower than 2, default is 2.
when mode is 1 speed works differently; when speed is 1 the window open instantly, when speed is 2 it open half the distance in the first frame half the remaining distance in the second and so on, when speed is 3 it open 30% of the remaining distance fist frame, 33.333% of the remaining distance the second and so on, when speed is 4 it moves 25% of the raining distence each frame, 5 it moves 20%, 6 > 16.666%, 7 > 14.2857%, ECT.
pin > should the top left corner be kept in the same place? true or false, default is false

NOTE: the close command disposes the contents of the window immediately and will automatically disposes of the window when the animation is complete. make sure you are aware of this when calling the update method.

NOTE: NO animation will take place unless the update method is called.

Spoiler for AdvSelectable only instructions:
to use simple make a subclass and do what you would normal do for a selectable window but follow the instruction for AdvBase too. be sure to set the item and column maxes in the finalize method.

this class not only adds animation but it makes it easier to set up selectable windows correctly all around, the instance variable @offset controls the horizontal off set between each menu item changing it will automatically refresh the window and if you use it in you drawing methods every thing will come out right automatically. the same can be said for @row_size and @column_size these control the height of each row and the width of each column respectively and changing them will refresh the window and update the cursor.


Compatibility

should work with anything

Credits and Thanks


Author's Notes

this class contain none of Window_Base's drawing methods so if you want them include them in you sub class

I made this... well... because I wanted to. it will make making any animated system easier

NOTE: I (the author) do NOT provide support in this thread. I simply don't visit this forum often enough. another scripter may be able to offer help but if you need support from me please go here http://forum.chaos-project.com/index.php?topic=4053.0 (http://forum.chaos-project.com/index.php?topic=4053.0)