#======================================================================== # @> Sliding Windows Stuff ~ Karin's Soulkeeper, 2015 #------------------------------------------------------------------------ # 2015.12.05 (1.0) - Finished # 2015.11.28 (0.1) - Started #------------------------------------------------------------------------ # * IMPORTANT: # This is NOT A PLUG-AND-PLAY SCRIPT. This is intended for those # who know some scripting. #------------------------------------------------------------------------ # * Note: # NEVER mix up the initialize portions! #------------------------------------------------------------------------ # * Description: # Below is the template I used to make windows slide-in/out # from the screen, instead of the default window open/close anims. #------------------------------------------------------------------------ # * To Use: # Ideally, create an overwrite of the window you want to slide- # in/out, then paste any one of the versions you prefer, then # insert the lines in the initialize method on top of the # target window's original initialize (but below the super call). # # Adjust slide_rate according to how fast you want it to be. # (higher is faster in both cases) #------------------------------------------------------------------------ # For example, to make the menu status window slide from the right: #------------------------------------------------------------------------ # class Window_MenuStatus < Window_Selectable # def initialize(x, y) # super(x, y, window_width, window_height) # @start_x = Graphics.width + self.width # <= added this # self.x = @start_x # <= added this # @pending_index = -1 # refresh # end # def slide_rate # return 48 # end # def open? # return self.x == Graphics.width - self.width # end # def close? # return self.x == @start_x # end # def update_open # self.x = [Graphics.width - self.width, self.x - slide_rate].max # @opening = false if open? # end # def update_close # self.x = [@start_x, self.x + slide_rate].min # @closing = false if close? # end # def open # @opening = true unless open? # @closing = false # self # end # end #------------------------------------------------------------------------ # * Terms: # Free to use in any kind of project, with or without credit. I wouldn't # really mind. Though I'd appreciate it! (^w^)/ # Just don't, you know, claim that you made this here script yourself, # Because that's just mean (._.) #======================================================================== #------------------------------------------------------------------------ # Slide in from left open process start (fromLeft) #------------------------------------------------------------------------ def slide_rate return 48 end def open? return self.x == 0 end def close? self.x == @start_x end def update_open self.x = [0, self.x + slide_rate].min @opening = false if open? end def update_close self.x = [@start_x, self.x - slide_rate].max @closing = false if close? end def open @opening = true unless open? @closing = false self end def initialize self.x = -self.width @start_x = self.x end #------------------------------------------------------------------------ # Slide in from right open process start (fromRight) #------------------------------------------------------------------------ def slide_rate return 48 end def open? return self.x == Graphics.width - self.width end def close? return self.x == @start_x end def update_open self.x = [Graphics.width - self.width, self.x - slide_rate].max @opening = false if open? end def update_close self.x = [@start_x, self.x + slide_rate].min @closing = false if close? end def open @opening = true unless open? @closing = false self end def initialize(x, y) @start_x = Graphics.width + self.width self.x = @start_x end #------------------------------------------------------------------------ # Slide in from left open process start (fromTop) #------------------------------------------------------------------------ def slide_rate return 48 end def open? return self.y == 0 end def close? self.y == @start_y end def update_open self.y = [0, self.y + slide_rate].min @opening = false if open? end def update_close self.y = [@start_y, self.y - slide_rate].max @closing = false if close? end def open @opening = true unless open? @closing = false self end def initialize self.y = -self.height @start_y = self.y end #------------------------------------------------------------------------ # Slide in from right open process start (fromBottom) #------------------------------------------------------------------------ def slide_rate return 48 end def open? return self.y == Graphics.height - self.height end def close? return self.y == @start_y end def update_open self.y = [Graphics.height - self.height, self.y - slide_rate].max @opening = false if open? end def update_close self.y = [@start_y, self.x + slide_rate].min @closing = false if close? end def open @opening = true unless open? @closing = false self end def initialize(x, y) @start_y = Graphics.height + self.height self.y = @start_y end