module ADIK module MAP_HUD #HUD modes #"constant" => maximum length of bars/gauges is constant #"scaling" => maximum length of bars/gauges scale depending on maximum MODE = "constant" #Maximum width of hp gauges : constant mode GAUGE_WIDTH_HP = 544/4 #Height of hp gauges GAUGE_HEIGHT_HP = 416/10 #Maximum width of mp gauges : constant mode GAUGE_WIDTH_MP = 544/4 #Height of mp gauges GAUGE_HEIGHT_MP = 416/10 #HP per pixel : scaling mode HP_PER_PIXEL = 10 #MP per pixel : scaling mode MP_PER_PIXEL = 10 #Use gauge images? GAUGE_IMAGES = false #If true: #HP Gauge background GAUGE_BG_HP = "" #MP Gauge background GAUGE_BG_MP = "" #HP Gauge image GAUGE_HP = "" #MP Gauge image GAUGE_MP = "" #else #Color.new(R,G,B,A) #Set A to 0 if you want invisible #HP Gauge background color GAUGE_BGC_HP = Color.new(50,50,50,150) #MP Gauge background color GAUGE_BGC_MP = Color.new(50,50,50,150) #HP Gauge color GAUGE_C_HP = Color.new(0,255,0,200) #MP Gauge color GAUGE_C_MP = Color.new(0,0,255,200) #Use gradient color? GAUGE_GRADIENT = true #HP Gauge color 2 GAUGE_C_HP_2 = Color.new(200,255,0,200) #MP Gauge color 2 GAUGE_C_MP_2 = Color.new(200,0,255,200) #end #X position of hp gauge X_HP = 50 #Y position of hp gauge Y_HP = 50 #X position of mp gauge X_MP = 100 #Y position of mp gauge Y_MP = 100 #Z of gauges GAUGES_Z = 300 #Actor ID ACTOR = 1 attr_accessor :use_hud attr_accessor :sprite_bg attr_accessor :sprite_b attr_accessor :viewport attr_accessor :hp_bg_bit attr_accessor :mp_bg_bit attr_accessor :hp_b_bit attr_accessor :mp_b_bit attr_accessor :actor attr_accessor :hp attr_accessor :mp attr_accessor :maxhp attr_accessor :maxmp def self.init @use_hud = false @viewport = Viewport.new @sprite_bg = Sprite_Base.new(@viewport) @sprite_bg.z = GAUGES_Z - 1 @sprite_bg.bitmap = Bitmap.new(544,416) @sprite_b = Sprite_Base.new(@viewport) @sprite_b.z = GAUGES_Z @sprite_b.bitmap = Bitmap.new(544,416) if GUAGE_IMAGES @hp_bg_bit = Cache.pictures(GAUGE_BG_HP) @mp_bg_bit = Cache.pictures(GAUGE_BG_MP) @hp_b_bit = Cache.pictures(GAUGE_HP) @mp_b_bit = Cache.pictures(GAUGE_MP) end @actor = $game_actors[ACTOR] @hp = [] @mp = [] @maxhp = [] @maxmp = [] end def self.toggle @use_hud = not @use_hud if @use_hud self.update(true) else @sprite_b.bitmap.clear @sprite_bg.bitmap.clear end end def self.change_actor(id) @actor = $game_actors[id] self.update end def self.update(forced=false) unless forced return if not @use_hud return if not SceneManager.scene_is?(Scene_Map) #return if scene_changing? return if not @actor return if @actor.hp == @hp[actor.id] and @actor.mp == @mp[actor.id] and @actor.mhp == @maxhp[actor.id] and @actor.mmp == @maxmp[actor.id] end @hp[actor.id] = @actor.hp @mp[actor.id] = @actor.mp @maxhp[actor.id] = @actor.mhp @maxmp[actor.id] = @actor.mmp @sprite_b.bitmap.clear @sprite_bg.bitmap.clear if MODE == "constant" rect_hp = Rect.new(X_HP,Y_HP,GAUGE_WIDTH_HP,GAUGE_HEIGHT_HP) rect_mp = Rect.new(X_MP,Y_MP,GAUGE_WIDTH_MP,GAUGE_HEIGHT_MP) else rect_hp = Rect.new(X_HP,Y_HP,@actor.mhp/HP_PER_PIXEL,GAUGE_HEIGHT_HP) rect_mp = Rect.new(X_MP,Y_MP,@actor.mmp/MP_PER_PIXEL,GAUGE_HEIGHT_MP) end if GAUGE_IMAGES rect = Rect.new(0,0,@hp_bg_bit.width,@hp_bg_bit.height) @sprite_bg.bitmap.stretch_blt(rect_hp,@hp_bg_bit,rect) rect = Rect.new(0,0,@mp_bg_bit.width,@mp_bg_bit.height) @sprite_bg.bitmap.stretch_blt(rect_mp,@mp_bg_bit,rect) rect = Rect.new(0,0,@hp_b_bit.width,@hp_b_bit.height) rect_hp.width *= @actor.hp_rate @sprite_b.bitmap.stretch_blt(rect_hp,@hp_bg_bit,rect) rect_mp.width *= @actor.mp_rate rect = Rect.new(0,0,@mp_b_bit.width,@mp_b_bit.height) @sprite_b.bitmap.stretch_blt(rect_mp,@mp_bg_bit,rect) else @sprite_bg.bitmap.fill_rect(rect_hp,GAUGE_BGC_HP) @sprite_bg.bitmap.fill_rect(rect_mp,GAUGE_BGC_MP) rect_hp.width *= @actor.hp_rate rect_mp.width *= @actor.mp_rate if GAUGE_GRADIENT @sprite_bg.bitmap.gradient_fill_rect(rect_hp,GAUGE_C_HP,GAUGE_C_HP_2) @sprite_bg.bitmap.gradient_fill_rect(rect_mp,GAUGE_C_MP,GAUGE_C_MP_2) else @sprite_bg.bitmap.fill_rect(rect_hp,GAUGE_C_HP) @sprite_bg.bitmap.fill_rect(rect_mp,GAUGE_C_MP) end end end endendclass Scene_Map alias update_adik_map_hud update def update update_adik_map_hud ADIK::MAP_HUD.update endend