Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # PaS HUD v.1.1 by DarkCloud
- #
- # ~~>Historia
- # ~>Wersja 1.1
- # -Zmienione grafiki barów
- # -Dodany Exp bar
- # -Informacja o obecnym lvl'u
- # -Pozycjonowanie HUD'a
- # *215:"@hudx = left/right" - Tu wybieramy pozycję poziomą HUD'a, lewy/prawy
- # *219:"@hudy = up/down" - Tu wybieramy pozycję pionową HUD'a, góra/dół
- #
- #==============================================================================
- #==============================================================================
- # ** Window_Base
- #------------------------------------------------------------------------------
- # This class is for all in-game windows.
- #==============================================================================
- class Window_Base < Window
- #=====================================
- # HUD Pic
- #=====================================
- def draw_hud(x, y)
- bitmap = RPG::Cache.picture("Hud")
- hw = bitmap.width
- hh = bitmap.height
- self.contents.blt(x , y , bitmap, Rect.new(0, 0, 204, 92))
- end
- #=====================================
- # Actor Avatar
- #=====================================
- def draw_actor_avatar(actor, x, y)
- bitmap = RPG::Cache.character("Avatars/" + actor.name, actor.character_hue)
- aw = bitmap.width
- ah = bitmap.height
- self.contents.blt(x , y , bitmap, Rect.new(0, 0, aw, ah))
- end
- #=====================================
- # Actor Name
- #=====================================
- def draw_actor_hud_name(actor, x, y)
- self.contents.font.name = "Calligula"
- self.contents.font.color = normal_color
- self.contents.font.size = 14
- self.contents.draw_text(x, y, 120, 32, actor.name)
- end
- #=====================================
- # Actor level
- #=====================================
- def draw_actor_lv(actor, x, y)
- self.contents.font.name = "Calligula"
- self.contents.font.color = Color.new(0, 180, 0)
- self.contents.font.size = 12
- self.contents.draw_text(x, y, 32, 32, "Lv")
- self.contents.font.name = "Arial"
- self.contents.font.color = Color.new(200, 200, 0)
- self.contents.font.size = 15
- self.contents.draw_text(x + 10, y - 1, 24, 32, actor.level.to_s, 2)
- end
- #=====================================
- # Actor HP bar
- #=====================================
- def draw_actor_hp_bar(actor, x, y)
- @actor = $game_party.actors[0]
- whp = 160 * @actor.hp / @actor.maxhp
- self.contents.font.name = "Calligula"
- self.contents.font.color = Color.new(0, 180, 0)
- self.contents.font.size = 12
- self.contents.draw_text(x - 20, y - 12, 32, 32, "")
- self.contents.fill_rect(x, y, 160, 0, Color.new(0, 0, 0, 255))
- self.contents.fill_rect(x, y + 1, whp, 1, Color.new(255, 0, 0))
- self.contents.fill_rect(x, y + 2, whp, 1, Color.new(235, 0, 0))
- self.contents.fill_rect(x, y + 3, whp, 1, Color.new(215, 0, 0))
- self.contents.fill_rect(x, y + 4, whp, 1, Color.new(195, 0, 0))
- self.contents.fill_rect(x, y + 5, whp, 1, Color.new(175, 0, 0))
- self.contents.fill_rect(x, y + 6, whp, 1, Color.new(155, 0, 0))
- self.contents.fill_rect(x, y + 7, whp, 1, Color.new(135, 0, 0))
- self.contents.fill_rect(x, y + 8, whp, 1, Color.new(115, 0, 0))
- self.contents.fill_rect(x, y + 9, whp, 1, Color.new(95, 0, 0))
- self.contents.fill_rect(x, y + 10, whp, 1, Color.new(85, 0, 0))
- self.contents.fill_rect(x, y + 11, whp, 1, Color.new(75, 0, 0))
- self.contents.fill_rect(x, y + 12, whp, 1, Color.new(65, 0, 0))
- self.contents.fill_rect(x, y + 13, whp, 1, Color.new(55, 0, 0))
- self.contents.fill_rect(x, y + 14, whp, 1, Color.new(45, 0, 0))
- self.contents.fill_rect(x, y + 15, whp, 1, Color.new(35, 0, 0))
- self.contents.fill_rect(x, y + 16, whp, 1, Color.new(25, 0, 0))
- self.contents.fill_rect(x, y + 17, whp, 1, Color.new(15, 0, 0))
- self.contents.fill_rect(x, y + 18, whp, 1, Color.new(5, 0, 0))
- self.contents.fill_rect(x, y + 19, whp, 1, Color.new(0, 0, 0))
- bitmap = RPG::Cache.picture("HP_SP_bar")
- hbw = bitmap.width
- hbh = bitmap.height
- self.contents.blt(x , y , bitmap, Rect.new(0, 0, hbw, hbh))
- end
- #=====================================
- # Actor SP bar
- #=====================================
- def draw_actor_sp_bar(actor, x, y)
- @actor = $game_party.actors[0]
- wsp = 160 * @actor.sp / @actor.maxsp
- self.contents.font.name = "Calligula"
- self.contents.font.color = Color.new(0, 180, 0)
- self.contents.font.size = 12
- self.contents.draw_text(x - 18, y - 12, 32, 32, "")
- self.contents.fill_rect(x, y, 160, 0, Color.new(0, 0, 0, 255))
- self.contents.fill_rect(x, y + 1, wsp, 1, Color.new(0, 0, 255))
- self.contents.fill_rect(x, y + 2, wsp, 1, Color.new(0, 0, 235))
- self.contents.fill_rect(x, y + 3, wsp, 1, Color.new(0, 0, 215))
- self.contents.fill_rect(x, y + 4, wsp, 1, Color.new(0, 0, 195))
- self.contents.fill_rect(x, y + 5, wsp, 1, Color.new(0, 0, 175))
- self.contents.fill_rect(x, y + 6, wsp, 1, Color.new(0, 0, 155))
- self.contents.fill_rect(x, y + 7, wsp, 1, Color.new(0, 0, 135))
- self.contents.fill_rect(x, y + 8, wsp, 1, Color.new(0, 0, 115))
- self.contents.fill_rect(x, y + 9, wsp, 1, Color.new(0, 0, 95))
- self.contents.fill_rect(x, y + 10, wsp, 1, Color.new(0, 0, 85))
- self.contents.fill_rect(x, y + 11, wsp, 1, Color.new(0, 0, 75))
- self.contents.fill_rect(x, y + 12, wsp, 1, Color.new(0, 0, 65))
- self.contents.fill_rect(x, y + 13, wsp, 1, Color.new(0, 0, 55))
- self.contents.fill_rect(x, y + 14, wsp, 1, Color.new(0, 0, 45))
- self.contents.fill_rect(x, y + 15, wsp, 1, Color.new(0, 0, 35))
- self.contents.fill_rect(x, y + 16, wsp, 1, Color.new(0, 0, 25))
- self.contents.fill_rect(x, y + 17, wsp, 1, Color.new(0, 0, 15))
- self.contents.fill_rect(x, y + 18, wsp, 1, Color.new(0, 0, 5))
- self.contents.fill_rect(x, y + 19, wsp, 1, Color.new(0, 0, 0))
- bitmap = RPG::Cache.picture("HP_SP_bar")
- sbw = bitmap.width
- sbh = bitmap.height
- self.contents.blt(x , y , bitmap, Rect.new(0, 0, sbw, sbh))
- end
- #=====================================
- # Actor Exp bar
- #=====================================
- def draw_actor_exp_bar(actor, x, y)
- @actor = $game_party.actors[0]
- exp1 = actor.now_exp
- exp2 = actor.next_exp
- if actor.next_exp == 0
- exp1 = 1
- exp2 = 1
- end
- wexp = 150 * exp1 / exp2
- self.contents.fill_rect(x, y, 159, 19, Color.new(230, 230, 230, 150))
- self.contents.fill_rect(x, y + 1, wexp, 1, Color.new(255, 128, 0))
- self.contents.fill_rect(x, y + 2, wexp, 1, Color.new(235, 118, 0))
- self.contents.fill_rect(x, y + 3, wexp, 1, Color.new(215, 108, 0))
- self.contents.fill_rect(x, y + 4, wexp, 1, Color.new(195, 98, 0))
- bitmap = RPG::Cache.picture("Exp_bar")
- ebw = bitmap.width
- ebh = bitmap.height
- self.contents.blt(x , y , bitmap, Rect.new(0, 0, ebw, ebh))
- end
- end
- #==============================================================================
- # ** Game_Actor
- #------------------------------------------------------------------------------
- # This class handles the actor. It's used within the Game_Actors class
- # ($game_actors) and refers to the Game_Party class ($game_party).
- #==============================================================================
- class Game_Actor < Game_Battler
- #--------------------------------------------------------------------------
- # * Get the current EXP
- #--------------------------------------------------------------------------
- def now_exp
- return @exp - @exp_list[@level]
- end
- #--------------------------------------------------------------------------
- # * Get the next level's EXP
- #--------------------------------------------------------------------------
- def next_exp
- return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
- end
- end
- #==============================================================================
- # ** Scene_Map
- #------------------------------------------------------------------------------
- # This class performs map screen processing.
- #==============================================================================
- class Scene_Map
- #--------------------------------------------------------------------------
- # * Main Processing
- #--------------------------------------------------------------------------
- alias hud_main main
- def main
- @Hud = Window_Hud.new
- hud_main
- @Hud.dispose if @Hud != nil
- end
- #--------------------------------------------------------------------------
- # * Frame Update
- #--------------------------------------------------------------------------
- alias hud_update update
- def update
- @Hud.update
- hud_update
- end
- end
- #==============================================================================
- # ** Window_Hud
- #------------------------------------------------------------------------------
- # This window displays HUD.
- #==============================================================================
- class Window_Hud < Window_Base
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- super(-16, -16, 300, 150)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.opacity = 0
- if $game_switches[1] == false
- self.x = -400
- end
- end
- #--------------------------------------------------------------------------
- # * Frame Update
- #--------------------------------------------------------------------------
- def update
- self.contents.clear
- actor = $game_party.actors[0]
- draw_hud(0, 0)
- draw_actor_hp_bar(actor, 17, 18)
- draw_actor_sp_bar(actor, 17, 48)
- #------------------------------------------------------------------------
- # * Hud position
- #------------------------------------------------------------------------
- left = - 16
- right = 436
- @hudx = left
- up = - 16
- down = 351
- @hudy = up
- if $game_switches[1] == true
- self.x = @hudx
- self.y = @hudy
- end
- if $game_switches[1] == false
- self.x = -400
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement