本帖最后由 VIPArcher 于 2018-12-23 00:44 编辑
补充一个使用多帧素材后菜单中绘制行走图的补丁。(例如存档界面等地方绘制的行走图)
class Window_Base < Window include VIPArcher::DIR8_ANIME #-------------------------------------------------------------------------- # ● 绘制人物行走图 #-------------------------------------------------------------------------- def draw_character(character_name, character_index, x, y) return unless character_name bitmap = Cache.character(character_name) if character_name =~ /\[f\d+#?\d*\]/i frame = get_frame(character_name) first = get_halt_name(character_name) else frame,first = 3,1 end sign = character_name[/^[\@\!\$]../] if sign && sign.include?('$') cw = bitmap.width / frame ch = bitmap.height / 4 else cw = bitmap.width / (frame * 4) ch = bitmap.height / 8 end n = character_index src_rect = Rect.new((n%4*3+first)*cw, (n/4*4)*ch, cw, ch) contents.blt(x - cw / 2, y - ch, bitmap, src_rect) end end
class Window_Base < Window
include VIPArcher::DIR8_ANIME
#--------------------------------------------------------------------------
# ● 绘制人物行走图
#--------------------------------------------------------------------------
def draw_character(character_name, character_index, x, y)
return unless character_name
bitmap = Cache.character(character_name)
if character_name =~ /\[f\d+#?\d*\]/i
frame = get_frame(character_name)
first = get_halt_name(character_name)
else
frame,first = 3,1
end
sign = character_name[/^[\@\!\$]../]
if sign && sign.include?('$')
cw = bitmap.width / frame
ch = bitmap.height / 4
else
cw = bitmap.width / (frame * 4)
ch = bitmap.height / 8
end
n = character_index
src_rect = Rect.new((n%4*3+first)*cw, (n/4*4)*ch, cw, ch)
contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
end
end
|