Home > RGSS Script Reference > Window_MenuStatus
Window_MenuStatus
Inherits from: Window_Selectable
Description: This window shows the name, level, HP, SP, and status of each party member. It inherits from Window_Selectable rather than Window_Base because certain menu commands require that a target be selected.
class Window_MenuStatus < Window_Selectable
# ------------------------------------
def initialize
super(0, 0, 480, 480)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
self.active = false
self.index = -1
end
# ------------------------------------
def refresh
self.contents.clear
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
x = 64
y = i * 116
actor = $game_party.actors[i]
draw_actor_graphic(actor, x - 40, y + 80)
draw_actor_name(actor, x, y)
draw_actor_class(actor, x + 144, y)
draw_actor_level(actor, x, y + 32)
draw_actor_state(actor, x + 90, y + 32)
draw_actor_exp(actor, x, y + 64)
draw_actor_hp(actor, x + 236, y + 32)
draw_actor_sp(actor, x + 236, y + 64)
end
end
# ------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(0, @index * 116, self.width - 32, 96)
end
end
end
|
This class has no properties.
Initialize
Arguments: None
Local Variables: None
How it Works: This method initializes the window's state. First, it sets the x and y coordinates of the window's upper-left pixel to 0, and its width and height to 640 and 480, respectively. The window is then set to be inactive and its index is set to -1, so that the selection cursor won't show. The call to refresh draws all the text in the window.
Refresh
Arguments: None
Local Variables: None
How it Works: This method draws the window's contents. First, the value of @item_max is set to be the number of characters in the party. For each character in the party, the various elements in the character's status are drawn relative to the x and y coordinates declared in the first two statements of the loop (x = 64, and y = 116 times the relative position of the party member, by default). Explanations of the methods called to draw the different elements can all be found in the documentation for Window_Base.
Update_Cursor_Rect
Arguments: None
Local Variables: None
How it Works: This method updates the position of the cursor rectangle. If the window's index is less than 0, then the cursor rectangle is set to be empty (invisible). Otherwise, the rectangle is set to be at x coordinate 0 and y coordinate 116, times the relative party position of the currently selected party member (remember that the top party member is at index 0).
|
|