Custom Bar Graphic
DescrizionePermette di creare delle barre con la grafica personalizzata.
Le barre possono essere verticali o orizzontali.
Possibilita di avere delle barre per ciascun attributo.
Autore
The Sleeping Leonhart
Script
<div style="margin:20px;margin-top:5px" "="">
#============================================================================== # ** Custom Bar Graphic #============================================================================== # The Sleeping Leonhart # Versione 1.0 # 20-04-2008 #------------------------------------------------------------------------------ # Cronologia Versioni: # * Versione 1.0 (20-04-2008) #============================================================================== # Feature: # * Permette di creare delle barre con la grafica personalizzata. # * Le barre possono essere verticali o orizzontali. # * Possibilita di avere delle barre per ciascun attributo. #============================================================================== # Istruzioni: # Per creare una barra utilizzate il metodo draw_bar con i seguenti attributi: # (x, y, grafica_barra_vuota, grafica_barra_piena, valore_attuale_barra, # valore_massimo_barra, tipo) # Il tipo pu? essere "v"(verticale) o "o"(orizzontale). # La grafica delle barre va messa nella Cartella Pictures. #============================================================================== # Impostazioni module TSL_Custom_Bar_Graphic #Sintassi: BARRA_ATTRIBUTO(GraficaBarraVuota, GraficaBarraPiene, Visibile?) BARRA_HP = ["Barra Vuota", "Barra HP", true] BARRA_MP = ["Barra Vuota", "Barra MP", true] BARRA_EXP = ["Barra Vuota", "Barra EXP", true] BARRA_ATK = ["Barra Vuota", "Barra ATK", true] BARRA_PDEF = ["Barra Vuota", "Barra PDEF", true] BARRA_MDEF = ["Barra Vuota", "Barra MDEF", true] BARRA_STR = ["Barra Vuota", "Barra STR", true] BARRA_DEX = ["Barra Vuota", "Barra DEX", true] BARRA_AGI = ["Barra Vuota", "Barra AGI", true] BARRA_INT = ["Barra Vuota", "Barra INT", true] end #============================================================================== class Game_Actor < Game_Battler def exp_adesso return @exp - @exp_list[@level] end def prox_exp return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0 end end class Window_Base include TSL_Custom_Bar_Graphic def draw_bar(x, y, barravuota, barrapiena, corrente, max, tipo) barra_vuota = Bitmap.new("Graphics/Pictures/"+barravuota) barra_piena = Bitmap.new("Graphics/Pictures/"+barrapiena) taglio = corrente.to_f / max.to_f cwp = barra_piena.width cwv = barra_vuota.width chp = barra_piena.height chv = barra_vuota.height if tipo == "o" taglio = taglio*cwp src_rect = Rect.new(0, 0, taglio, chp) self.contents.blt(32+x-cwp/4, 18+y-chp/2, barra_piena, src_rect) src_rect = Rect.new(taglio, 0, cwv-taglio, chv) self.contents.blt(32+x-cwv/4+taglio, 18+y-chv/2, barra_vuota, src_rect) elsif tipo == "v" taglio = taglio*chp src_rect = Rect.new(0, 0, cwp, taglio) self.contents.blt(32+x-cwp/4, 18+y-chp/2, barra_piena, src_rect) src_rect = Rect.new(0, taglio, cwv, chv-taglio) self.contents.blt(32+x-cwv/4, 18+y-chv/2+taglio, barra_vuota, src_rect) end end alias tslcbg_wndwbs_drwactrhp draw_actor_hp def draw_actor_hp(actor, x, y, width = 144) draw_bar(x, y, BARRA_HP[0], BARRA_HP[1], actor.sp, actor.maxsp, "o") if BARRA_HP[2] tslcbg_wndwbs_drwactrhp(actor, x, y, width = 144) end alias tslcbg_wndwbs_drwactrsp draw_actor_sp def draw_actor_sp(actor, x, y, width = 144) draw_bar(x, y, BARRA_MP[0], BARRA_MP[1], actor.sp, actor.maxsp, "o") if BARRA_MP[2] tslcbg_wndwbs_drwactrsp(actor, x, y, width = 144) end alias tslcbg_wndwbs_drwactrxp draw_actor_exp def draw_actor_exp(actor, x, y) draw_bar(x, y, BARRA_EXP[0], BARRA_EXP[1], actor.exp_adesso, actor.prox_exp, "o") if BARRA_EXP[2] tslcbg_wndwbs_drwactrxp(actor, x, y) end alias tslcbg_wndwbs_drwactrprm draw_actor_parameter def draw_actor_parameter(actor, x, y, type) case type when 0 draw_bar(x, y, BARRA_ATK[0], BARRA_ATK[1], actor.atk, 999, "o") if BARRA_ATK[2] when 1 draw_bar(x, y, BARRA_PDEF[0], BARRA_PDEF[1], actor.pdef, 999, "o") if BARRA_PDEF[2] when 2 draw_bar(x, y, BARRA_MDEF[0], BARRA_MDEF[1], actor.mdef, 999, "o") if BARRA_MDEF[2] when 3 draw_bar(x, y, BARRA_STR[0], BARRA_STR[1], actor.str, 999, "o") if BARRA_STR[2] when 4 draw_bar(x, y, BARRA_DEX[0], BARRA_DEX[1], actor.dex, 999, "o") if BARRA_DEX[2] when 5 draw_bar(x, y, BARRA_AGI[0], BARRA_AGI[1], actor.agi, 999, "o") if BARRA_AGI[2] when 6 draw_bar(x, y, BARRA_INT[0], BARRA_INT[1], actor.int, 999, "o") if BARRA_INT[2] end tslcbg_wndwbs_drwactrprm(actor, x, y, type) end end
Istruzioni per l'uso
Per creare una barra utilizzate il metodo draw_bar con i seguenti attributi:
(x, y, grafica_barra_vuota, grafica_barra_piena, valore_attuale_barra,valore_massimo_barra, tipo)
Il tipo pu? essere "v"(verticale) o "o"(orizzontale), la grafica delle barre va messa nella Cartella Pictures.Guardare le impostazioni per le barre degli attributi.
Bugs e Conflitti Noti
N/A