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

 Username:
 Password:
   Not a member? Register!



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.

Code


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

Properties


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.

Methods


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. 
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