Advertisement
Senbonzakura1

Untitled

Aug 24th, 2019
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.41 KB | None | 0 0
  1. #==============================================================================
  2. # ** Sprite_HUD
  3. #------------------------------------------------------------------------------
  4. # Autor: Valentine
  5. #==============================================================================
  6. #** HUD Modificada
  7. #==============================================================================
  8. # Modificado por: Senbonzakura
  9. #==============================================================================
  10.  
  11. class Sprite_HUD < Sprite
  12.  
  13. def initialize
  14. super
  15. self.bitmap = Bitmap.new(600, 600) # Tamanho da tela da HUD
  16. self.x = 240 # Posição X da HUD
  17. self.y = 399 # POsição Y da HUD
  18. self.z = 0 # Profundidade da HUD
  19. self.bitmap.font.size = 18 # Tamanho da fonte
  20. self.bitmap.font.bold = true # Fonte c/ Bold ou não
  21. @back = Cache.system('HUD') # Imagem da Barra de HUD
  22. @HP_bar = Cache.system('Hp_Bar') # Imagem da Barra de HP
  23. @MP_bar = Cache.system('Mp_Bar') # Imagem da Barra de MP
  24. @XP_bar = Cache.system('Xp_Bar') # Imagem da Barra de EXP
  25. create_exp_bar
  26. refresh
  27. end
  28.  
  29. def dispose
  30. super
  31. @exp_sprite.bitmap.dispose
  32. @exp_sprite.dispose
  33. end
  34.  
  35. def create_exp_bar
  36. @exp_sprite = Sprite2.new
  37. @exp_sprite.bitmap = Bitmap.new(600,3) # Tamanho da tela da HUD
  38. @exp_sprite.bitmap.font.size = 28 # Tamanho da Fonte da Letra
  39. @exp_sprite.bitmap.font.bold = true # Letra em Negrito ou não
  40. @exp_sprite.x = Graphics.width - 173 # Posição X da Barra de EXP
  41. @exp_sprite.y = Graphics.height - 4 # Posição Y da Barra de EXP
  42. @exp_sprite.dragable = false
  43. @exp_sprite.z = self.z
  44. end
  45.  
  46. def refresh
  47. draw_background
  48. draw_hp_bar
  49. draw_mp_bar
  50. draw_exp_bar
  51. draw_level
  52. end
  53.  
  54. def draw_background
  55. self.bitmap.clear
  56. rect = Rect.new(0, 0, 640, 480) # Tamanho da tela da em aparece todos itens da hud
  57. self.bitmap.blt(7, 0, @back, rect)
  58. end
  59.  
  60. def draw_hp_bar
  61. # self.bitmap.blt(X, Y, @HP_bar, Rect.new(Altura, Largura, @HP_bar.width, @HP_bar.height * $game_actors[1].hp / $game_actors[1].mhp))
  62. self.bitmap.blt(30, 6, @HP_bar.angle = 180, Rect.new(0, 0, 100 / @HP_bar.width , @HP_bar.height * $game_actors[1].hp / $game_actors[1].mhp))
  63.  
  64. def draw_mp_bar
  65. # self.bitmap.blt(X, Y, @MP_bar, Rect.new(Altura , Largura, @MP_bar.width , @MP_bar.height * $game_actors[1].mp / $game_actors[1].mmp))
  66. self.bitmap.blt(142, 6, @MP_bar, Rect.new(0, 0, 100 / @MP_bar.width , @MP_bar.height * $game_actors[1].mp / $game_actors[1].mmp))
  67. end
  68.  
  69. def draw_exp_bar
  70. @exp_sprite.bitmap.clear
  71. rect1 = Rect.new(0, 98, @exp_sprite.bitmap.width, @exp_sprite.bitmap.height)
  72. rect2 = Rect.new(0, 0, 170 * $game_actors[1].now_exp / $game_actors[1].next_exp, 26) # " 170 " é o comprimento da Barra EXP#
  73. exp = $game_actors[1].level >= Configs::MAX_LEVEL ? Vocab::MaxLevel : $game_actors[1].next_exp - $game_actors[1].now_exp
  74. @exp_sprite.bitmap.blt(0, 0, @back, rect1)
  75. @exp_sprite.bitmap.blt(0, 0, @XP_bar, rect2)
  76. end
  77.  
  78. def draw_level
  79. rect = Rect.new(0, 600, 29, 30)
  80. self.bitmap.blt(0, 77, @back, rect)
  81. self.bitmap.draw_text(600, 10, 30, 18, $game_actors[1].level, 1)
  82. end
  83.  
  84. def update
  85. super
  86. @exp_sprite.update
  87. end
  88.  
  89. end
  90. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement