Home > RGSS Script Reference > Arrow_Base
Arrow_Base
Inherits from: Sprite
Description: This class controls the behavior of the targetting cusror used in battles. The classes Arrow_Actor and Arrow_Enemy inherit functionality from this class.
class Arrow_Base < Sprite
# ------------------------------------
attr_reader :index
attr_reader :help_window
# ------------------------------------
def initialize(viewport)
super(viewport)
self.bitmap = RPG::Cache.windowskin($game_system.windowskin_name)
self.ox = 16
self.oy = 64
self.z = 2500
@blink_count = 0
@index = 0
@help_window = nil
update
end
# ------------------------------------
def index=(index)
@index = index
update
end
# ------------------------------------
def help_window=(help_window)
@help_window = help_window
if @help_window != nil
update_help
end
end
# ------------------------------------
def update
@blink_count = (@blink_count + 1) % 8
if @blink_count < 4
self.src_rect.set(128, 96, 32, 32)
else
self.src_rect.set(160, 96, 32, 32)
end
if @help_window != nil
update_help
end
end
end
|
Index: The relative group position of the actor or enemy to which the arrow is currently pointing.
Help_Window: A help window object that shows the name of the actor or enemy to which the arrow is pointing.
Blink_Count: The blink counter for the cursor. The value of @blink_count can range from 0-7. If the value is between 0 and 3, the first arrow cursor defined in the window skin is shown. If the value is between 4 and 7, the second arrow cursor defined in the window skin is shown.
Initialize
Arguments:
Viewport: The viewport for the arrow cursor.
Local Variables: None
How it Works: Constructs the arrow cursor. It's not clear what the call to Sprite#initialize does, since the user doesn't have access to the Sprite class. This class also initializes the arrow's location, z-index, index, and help window.
Index=
Arguments:
index: The new value of the index.
Local Variables: None
How it Works: Allows for setting of the index from outside the object.
Help_Window=
Arguments:
Help_Window: The help window object to be copied.
Local Variables: None
How it Works: Allows for a help_window object to be copied to the @help_window instance variable.
Update
Arguments: None
Local Variables: None
How it Works: This method updates the cursor in accordance with the blink count and updates the help window associated with the arrow if none exists. After the value of @blink_count is normalized, the arrow graphic and position are updated with the self.src_rect.set statements.
|
|