kkwo 发表于 2014-1-14 17:11
這樣可以嗎?
還是說要分成4張?
class << Mouse CursorFrames = [ [10, 0, 8], # 设置图片的中心坐标、帧数 [0, 50, 8], [20, 32, 8], [32, 50, 8] ] CursorSize = 64 #单个图标大小 SwitchFrames = 10 #切换等待帧数 def create_cursor(vp) dispose_cursor if @sprite [url=home.php?mod=space&uid=114926]@sprite[/url] = Sprite.new(vp) @sprite.z = 9999 if File.exist?('Graphics/System/VariableCursor.png') @sprite.bitmap = Cache.system('VariableCursor') else msgbox("Graphics/System/VariableCursor.png 缺失") exit end @sprite.src_rect.set(0, 0, CursorSize, CursorSize) change_cursor(0) update_cursor end def change_cursor(i) return if @cursor_i == i @cursor_c = 0 @cursor_i = i @sprite.ox, @sprite.oy, @cursor_f = *CursorFrames[i] @cursor_f *= SwitchFrames @sprite.src_rect.y = CursorSize * i update_cursor_graphics end alias_method :change_cursor_update, :update def update change_cursor_update update_cursor_graphics end def update_cursor_graphics @cursor_c += 1 @cursor_c = 0 if @cursor_c > @cursor_f @sprite.src_rect.x = @cursor_c / SwitchFrames * CursorSize end end class Scene_Map alias_method :change_cursor_update_mouse_action, :update_mouse_action def update_mouse_action $game_map.events_xy($game_map.mouse_map_x, \ $game_map.mouse_map_y).each {|event| if event.mouse_start? Mouse.change_cursor(1) change_cursor_update_mouse_action return elsif event.cursor_index Mouse.change_cursor(event.cursor_index) change_cursor_update_mouse_action return end } Mouse.change_cursor(0) change_cursor_update_mouse_action end alias_method :change_cursor_sion_mouse_call_menu, :call_menu def call_menu Mouse.change_cursor(0) change_cursor_sion_mouse_call_menu end end class Game_Event attr_reader\ :locked, :cursor_index alias_method :change_cursor_lock, :lock def lock Mouse.change_cursor(0) change_cursor_lock end alias_method :change_cursor_sion_mouse_start, :sion_mouse_start def sion_mouse_start Mouse.change_cursor(0) change_cursor_sion_mouse_start end def sion_mouse_scan_list(cmd) return false unless cmd.code == 108 || cmd.code == 408 text = cmd.parameters[0] if text.include?("鼠标启动") @mouse_start = true @cursor_index = 1 #设置鼠标启动对应的鼠标指针索引 elsif /鼠标指针(\d+)/ =~ text @cursor_index = $1.to_i end return @cursor_index end end class Game_Player < Game_Character alias_method :change_cursor_make_encounter_count, :make_encounter_count def make_encounter_count Mouse.change_cursor(0) change_cursor_make_encounter_count end end
class << Mouse
CursorFrames = [
[10, 0, 8], # 设置图片的中心坐标、帧数
[0, 50, 8],
[20, 32, 8],
[32, 50, 8]
]
CursorSize = 64 #单个图标大小
SwitchFrames = 10 #切换等待帧数
def create_cursor(vp)
dispose_cursor if @sprite
[url=home.php?mod=space&uid=114926]@sprite[/url] = Sprite.new(vp)
@sprite.z = 9999
if File.exist?('Graphics/System/VariableCursor.png')
@sprite.bitmap = Cache.system('VariableCursor')
else
msgbox("Graphics/System/VariableCursor.png 缺失")
exit
end
@sprite.src_rect.set(0, 0, CursorSize, CursorSize)
change_cursor(0)
update_cursor
end
def change_cursor(i)
return if @cursor_i == i
@cursor_c = 0
@cursor_i = i
@sprite.ox, @sprite.oy, @cursor_f = *CursorFrames[i]
@cursor_f *= SwitchFrames
@sprite.src_rect.y = CursorSize * i
update_cursor_graphics
end
alias_method :change_cursor_update, :update
def update
change_cursor_update
update_cursor_graphics
end
def update_cursor_graphics
@cursor_c += 1
@cursor_c = 0 if @cursor_c > @cursor_f
@sprite.src_rect.x = @cursor_c / SwitchFrames * CursorSize
end
end
class Scene_Map
alias_method :change_cursor_update_mouse_action, :update_mouse_action
def update_mouse_action
$game_map.events_xy($game_map.mouse_map_x, \
$game_map.mouse_map_y).each {|event|
if event.mouse_start?
Mouse.change_cursor(1)
change_cursor_update_mouse_action
return
elsif event.cursor_index
Mouse.change_cursor(event.cursor_index)
change_cursor_update_mouse_action
return
end
}
Mouse.change_cursor(0)
change_cursor_update_mouse_action
end
alias_method :change_cursor_sion_mouse_call_menu, :call_menu
def call_menu
Mouse.change_cursor(0)
change_cursor_sion_mouse_call_menu
end
end
class Game_Event
attr_reader\
:locked,
:cursor_index
alias_method :change_cursor_lock, :lock
def lock
Mouse.change_cursor(0)
change_cursor_lock
end
alias_method :change_cursor_sion_mouse_start, :sion_mouse_start
def sion_mouse_start
Mouse.change_cursor(0)
change_cursor_sion_mouse_start
end
def sion_mouse_scan_list(cmd)
return false unless cmd.code == 108 || cmd.code == 408
text = cmd.parameters[0]
if text.include?("鼠标启动")
@mouse_start = true
@cursor_index = 1 #设置鼠标启动对应的鼠标指针索引
elsif /鼠标指针(\d+)/ =~ text
@cursor_index = $1.to_i
end
return @cursor_index
end
end
class Game_Player < Game_Character
alias_method :change_cursor_make_encounter_count, :make_encounter_count
def make_encounter_count
Mouse.change_cursor(0)
change_cursor_make_encounter_count
end
end
你这个素材没对齐 - -b
用这个替换原来的指针脚本,图片也替换掉就可以了。 |