Home > RGSS Script Reference > Scene_Status
Scene_Status
Inherits from: None
Description: This class contains the windows for the character status screen that can be accessed from the main menu.
class Scene_Status
# ------------------------------------
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
end
# ------------------------------------
def main
@actor = $game_party.actors[@actor_index]
@status_window = Window_Status.new(@actor)
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@status_window.dispose
end
# ------------------------------------
def update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new(3)
return
end
if Input.trigger?(Input::R)
$game_system.se_play($data_system.cursor_se)
@actor_index += 1
@actor_index %= $game_party.actors.size
$scene = Scene_Status.new(@actor_index)
return
end
if Input.trigger?(Input::L)
$game_system.se_play($data_system.cursor_se)
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
$scene = Scene_Status.new(@actor_index)
return
end
end
end
|
Actor_Index: The relative position within the party of the actor whose status is being viewed.
Actor: The absolute ID of the actor whose status is being viewed.
Status_Window: A Window_Status object that shows the actor's status.
Initialize
Arguments: None
Local Variables: None
How it Works: This method sets the relative party position of the actor whose status is being viewed to the value passed to this method.
Main
Arguments: None
Local Variables: None
How it Works: This is the main method for this class. It processes the update, and disposes of the object. First, the absolute ID of the actor whose status is being viewed is set using the actor index acquired during initialization. Next, the status window is initalized. The main loop updates the graphics, checks for input, and updates the window in response to user input. Once the value of $Scene has changed (when the user leaves the status menu), the final part of the method disposes of the status window.
Update
Arguments: None
Local Variables: None
How it Works: This method responds to user input from the status window. If the user input is "B" (cancel key), then the cancel sound effect is played, and control is transferred back to the menu. If the user input is "R", then the cursor sound effect is played, and the actor index is incremented. The method then takes the modulous of the current index and the party size to see what the new index should be. A new status window is then created with the new actor index. If the user input is "L", then the cursor sound effect is played, and the actor index is decremented. The method then does the same as above to determine the new index. A new status window is then created with the new actor index.
|
|