02-20-2010, 02:12 PM
want to include a cursor infront of the selection?
script:
animation add-on (need script above):
default cursor
black(by me)
white(by me)
script:
Code:
#==============================================================================
#????Arrow-Type Selection Cursor?ver. 1.12???
#??Script by ParaDog
#??http://2d6.parasite.jp/
#------------------------------------------------------------------------------
# Uses an optional picture for the cursor in command selection windows.
#==============================================================================
module PARA_LEFT_CURSOR
# Name of the cursor file (in the "Graphics/Windowskin" folder)
FILE_NAME = "cursor"
# Cursor type ? 0: Arrow / 1: Arrow & Rect Border ?
TYPE = 0
end
# End of the config section
#------------------------------------------------------------------------------
#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# This class is for all in-game windows.
#==============================================================================
class Window_Base
#--------------------------------------------------------------------------
# * Update Cursor Rectangle
#--------------------------------------------------------------------------
alias cursor_rect_para_lcr cursor_rect
def cursor_rect=(rect)
if PARA_LEFT_CURSOR::TYPE == 1
super(rect)
end
empty = Rect.new(0,0,0,0)
if rect != empty and self.visible != false and @index != -1
if @cursor == nil or @cursor.disposed?
# Draw the sprite
@cursor = Sprite.new
@cursor.bitmap = RPG::Cache.windowskin(PARA_LEFT_CURSOR::FILE_NAME)
end
# Move the position of cursor sprite
@cursor.x = self.x + rect.x
cy = (rect.height-32) / 2
@cursor.y = self.y + cy + rect.y + 16
@cursor.z = self.z + 2
elsif @cursor != nil
@cursor.dispose
end
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
alias dispose_para_cur dispose
def dispose
super
if @cursor != nil
@cursor.dispose
end
end
#--------------------------------------------------------------------------
# * self.visible
#--------------------------------------------------------------------------
def visible=(bool)
super
# Dispose if cursor and window contents bit map is set
if @cursor != nil and bool == false
@cursor.dispose
end
end
#--------------------------------------------------------------------------
# * self.x
#--------------------------------------------------------------------------
def x=(x)
super
if @index != nil
# Update cursor rectangle
update_cursor_rect
end
end
#--------------------------------------------------------------------------
# * self.y
#--------------------------------------------------------------------------
def y=(y)
super
if @index != nil
# Update cursor rectangle
update_cursor_rect
end
end
end
Code:
#==============================================================================
#??? Arrow-Type Selection Cursor - Animated Cursor ver. 1.00 ??
#??Script by ParaDog
#??http://2d6.parasite.jp/
#------------------------------------------------------------------------------
# An optional add-on for the "Arrow-Type Selection Cursor" script.
#------------------------------------------------------------------------------
# Uses the same cursor filename in the "Arrow-Type Selection Cursor" script for
# the individual files. If the cursor filename is 'hand' and the system is set
# for a 3 frame animation, the images used would be: hand1, hand2 and hand3
# to create the animated cursor.
#==============================================================================
module PARA_LEFT_CURSOR
# The number of images used in the cursor's animation
MAX_FRAMES = 3
# Animation delay speed.
# Smaller values decrease speed between animation frames (ie faster animation)
ANM_SPEED = 5
end
# End of the config section
#------------------------------------------------------------------------------
#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# This class is for all in-game windows.
#==============================================================================
class Window_Base
#--------------------------------------------------------------------------
# * Update Cursor Rectangle
#--------------------------------------------------------------------------
alias cursor_rect_para_lcr cursor_rect
def cursor_rect=(rect)
if PARA_LEFT_CURSOR::TYPE == 1
super(rect)
end
empty = Rect.new(0,0,0,0)
if rect != empty and self.visible != false and @index != -1
if @cursor == nil or @cursor.disposed?
# Draw the sprite
@cursor = Sprite.new
@cursor_anm_frame = 1
@cursor.bitmap = RPG::Cache.windowskin(PARA_LEFT_CURSOR::FILE_NAME+@cursor_anm_frame.to_s)
@cursor_wait = PARA_LEFT_CURSOR::ANM_SPEED
end
# Moving the position of cursor sprite
@cursor.x = self.x + rect.x
cy = (rect.height-32) / 2
@cursor.y = self.y + cy + rect.y + 16
@cursor.z = self.z + 2
elsif @cursor != nil
@cursor.dispose
end
end
#--------------------------------------------------------------------------
# * Frame update
#--------------------------------------------------------------------------
def update
super
if @cursor != nil and @cursor.disposed? == false
if @cursor_wait == nil or @cursor_wait <= 0
@cursor_wait = PARA_LEFT_CURSOR::ANM_SPEED
@cursor_anm_frame += 1
if @cursor_anm_frame > PARA_LEFT_CURSOR::MAX_FRAMES
@cursor_anm_frame = 1
end
@cursor.bitmap = RPG::Cache.windowskin(PARA_LEFT_CURSOR::FILE_NAME+@cursor_anm_frame.to_s)
else
@cursor_wait -= 1
end
end
end
end
black(by me)
white(by me)