Submit Your Article Guild Wars 2 Forum RPG Maker VX.com
 
RPG Maker
 

 Username:
 Password:
   Not a member? Register!



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.

Code


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

Properties


This class has no properties.

Methods


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). 
Syntax
@
@@
$
alias
[array index]
attr_accessor
attr_reader
attr_writer
class
def
do
ensure
for
if
[iterator]
key => value
new
next
nil
redo
require
return
rescue
self
super
undef
unless
until
while
yield

Classes
Arrow_Actor
Arrow_Base
Arrow_Enemy
Game_Actor
Game_Actors
Game_BattleAct
Game_Battler
Game_Character
Game_Common
Game_Enemy
Game_Event
Game_Map
Game_Party
Game_Picture
Game_Player
Game_Screen
Game_SlfSwitch
Game_Switches
Game_System
Game_Troop
Game_Variables
Interpreter
Scene_Debug
Scene_End
Scene_Equip
Scene_File
Scene_Gameover
Scene_Item
Scene_Load
Scene_Map
Scene_Menu
Scene_Name
Scene_Save
Scene_Shop
Scene_Skill
Scene_Status
Scene_Title
Sprite_Battler
Sprite_Character
Sprite_Picture
Sprite_Timer
Spriteset_Battle
Spriteset_Map
Window_Base
Window_Battleresult
Window_Battlestatus
Window_Command
Window_DebugLeft
Window_DebugRight
Window_EquipItem
Window_EquipLeft
Window_EquipRight
Window_Gold
Window_Help
Window_InputNumb
Window_Item
Window_MenuStatus
Window_Message
Window_NameEdit
Window_NameInput
Window_PartyCom
Window_PlayTime
Window_SaveFile
Window_Selectable
Window_ShopBuy
Window_ShopCom
Window_ShopNum
Window_ShopSell
Window_ShopStatus
Window_Skill
Window_SkillStatus
Window_Status
Window_Steps
Window_Target

Other
Class Hierarchy
Global Variables


RPG RPG Revolution
RPG RPG Revolution is your #1 stop for game development and console RPG games, as well as those created by people like you. Link to us to support us, so we may grow to be better website community for you.

RPG RPG Revolution is an Privacy Policy and Legal