Advertisement
DaxSoft

Head Hud Player 1.0 [Teste]

Jul 30th, 2015
290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.16 KB | None | 0 0
  1. #==============================================================================
  2. # • Head Hud Player
  3. #==============================================================================
  4. # Autor: Dax
  5. # Versão: 1.0
  6. # Site: www.dax-soft.weebly.com
  7. # Requerimento: Dax Core
  8. #==============================================================================
  9. # • Descrição:
  10. #------------------------------------------------------------------------------
  11. # Barrinha que mostra o HP do personagem, que ficará localizado na cabeça do
  12. # mesmo.
  13. #==============================================================================
  14. Dax.register(:head_hud_player, "dax", 1.0) {
  15. #==============================================================================
  16. # • Sprite_HeadHudPlayer
  17. #==============================================================================
  18. class Sprite_HeadHudPlayer < Sprite
  19. #----------------------------------------------------------------------------
  20. # • Inicialização dos objetos.
  21. #----------------------------------------------------------------------------
  22. def initialize
  23. super([32, 4, 0, 0, 200])
  24. update
  25. end
  26. #----------------------------------------------------------------------------
  27. # • Renovação dos objetos.
  28. #----------------------------------------------------------------------------
  29. def dispose
  30. self.bitmap.dispose
  31. super
  32. end
  33. #----------------------------------------------------------------------------
  34. # • Atualização dos objetos.
  35. #----------------------------------------------------------------------------
  36. def update
  37. self.x = $game_player.screen_x - (self.width / 2)
  38. self.y = $game_player.screen_y - (36 + (self.height / 2))
  39. self.bitmap.clear
  40. self.bitmap.fill_rect(self.rect, "000000".color)
  41. _actor = $game_party.members[0]
  42. _rect = Rect.new(0, 0, self.width.to_p(_actor.hp, _actor.mhp), self.height)
  43. self.bitmap.fill_rect(_rect, [200,0,0].color)
  44. end
  45. end
  46. #==============================================================================
  47. # • Spriteset_Map
  48. #==============================================================================
  49. class Spriteset_Map
  50. #----------------------------------------------------------------------------
  51. # • Inicialização dos objetos.
  52. #----------------------------------------------------------------------------
  53. alias :head_hud_player_init :initialize
  54. def initialize
  55. head_hud_player_init
  56. @sprite_head_hud_player = Sprite_HeadHudPlayer.new()
  57. end
  58. #----------------------------------------------------------------------------
  59. # • Renovação dos objetos.
  60. #----------------------------------------------------------------------------
  61. alias :head_hud_player_dispose :dispose
  62. def dispose
  63. head_hud_player_dispose
  64. @sprite_head_hud_player.dispose
  65. end
  66. #----------------------------------------------------------------------------
  67. # • Atualização dos objetos.
  68. #----------------------------------------------------------------------------
  69. alias :head_hud_player_update :update
  70. def update
  71. head_hud_player_update
  72. @sprite_head_hud_player.update rescue nil
  73. end
  74. end
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement