It's all
inheritance.
All windows come from Window_Base, which comes from the hidden class Window.
Let's look at Window_Base
#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# This class is for all in-game windows.
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# * Object Initialization
# x : window x-coordinate
# y : window y-coordinate
# width : window width
# height : window height
#--------------------------------------------------------------------------
def initialize(x, y, width, height)
super()
@windowskin_name = $game_system.windowskin_name
self.windowskin = RPG::Cache.windowskin(@windowskin_name)
self.x = x
self.y = y
self.width = width
self.height = height
self.z = 100
end
# ...
end
Now, just for kicks, let's look at Window_Steps
#==============================================================================
# ** Window_Steps
#------------------------------------------------------------------------------
# This window displays step count on the menu screen.
#==============================================================================
class Window_Steps < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, 96)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
# ...
end
Now, the
super keyword means, call the parent class method, with the same name. So when we create our step window, it calls the initialize method in Window_Base (Window_Gold < Window_Base), and sends 4 arguments to that method.
Back in Window_Base, we see that those four arguments set the x and y position, and the window width and height.
So, creating a new window class, we use:
class Window_Example < Window_Base
def initialize
super(x, y, width, height)
# code
end
# code
end
Just change your x - height variables.
Personal suggestion: RMXP uses basic intervals of 32, 16, 8 and 4. I would try to make most of your numbers divisible by 32 in tabbing conditions, and 16, 8 or 4 in positioning conditions. Avoid to numbers like 33, 17, 75, etc. Your game will just look better if everything lines up all neat. :thumb: