Advertisement
DaxSoft

Steampunk Hud 2.6

May 2nd, 2016
550
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 5.39 KB | None | 0 0
  1. #==============================================================================
  2. # • Steampunk Hud
  3. #==============================================================================
  4. # Autor: Dax
  5. # Versão: 2.6
  6. # Site: www.dax-soft.weebly.com
  7. # Requerimento: Dax Core
  8. #==============================================================================
  9. # • Descrição: TODAS AS IMAGENS NA PASTA 'SYSTEM'
  10. #   Description: All the pictures in the paste 'System'
  11. #------------------------------------------------------------------------------
  12. #  Sistema de HUD com Design Steampunk, onde mostra o HP mais o MP.
  13. #  System of HUD with design Steampunk, where show the hp and the mp.
  14. # **** Para ativar desativar HUD ****
  15. # **** To active/desactive HUD ***
  16. # Aperte a tecla do teclado 'D' — pode se mudar na linha 47
  17. # Press the key of keyboard 'D' - you can change in the line 47.
  18. # Use o comando (No chamar script) :
  19. # Use the command (In the call script) :
  20. #  $game_system.steam_hud = true # Ativa a HUD | Active the HUD.
  21. #  $game_system.steam_hud = false # Desativa a HUD | Desactive the HUD.
  22. #==============================================================================
  23. Ligni.register(:steampunk_hud, "dax", 2.6) {
  24. #==============================================================================
  25. # • Game_System
  26. #==============================================================================
  27. class Game_System
  28.   attr_accessor :steam_hud
  29.   alias :steam_hud_initialize :initialize
  30.   def initialize
  31.     steam_hud_initialize
  32.     @steam_hud = true
  33.   end
  34. end
  35. #==============================================================================
  36. # • Steampunk_HUD : Setup
  37. #==============================================================================
  38. rkey = [:steampunk_hud, "dax"]
  39. Ligni.param(rkey, :layout0, "S: Layout 0 - Back HUD")
  40. Ligni.param(rkey, :layout1, "S: Layout 1 - Icon HUD")
  41. Ligni.param(rkey, :layout_effect, "S: Efeito HUD")
  42. Ligni.param(rkey, :hp_meter, "Hp Meter HUD")
  43. Ligni.param(rkey, :mp_meter, "Mp Meter HUD")
  44. Ligni.param(rkey, :blend_type, 1)
  45. Ligni.param(rkey, :speed, 4)
  46. Ligni.param(rkey, :key, :D)
  47. Ligni.param(rkey, :actor_id, 1)
  48. #==============================================================================
  49. # • Sprite_Steampunk_Hud
  50. #==============================================================================
  51. class Sprite_Steampunk_Hud
  52.  
  53.   def param(key); Ligni.getParam([:steampunk_hud, "dax"], key); end;  
  54.   #----------------------------------------------------------------------------
  55.   # • Inicialização dos objetos.
  56.   #----------------------------------------------------------------------------
  57.   def initialize
  58.     @addon_x = 0
  59.     @addon_y = 0
  60.     @actor = $game_actors[param(:actor_id)]
  61.     @layout0 = Sprite.new(param(:layout0))
  62.     @layout0.z = 200
  63.     @layout0.x = 30 + @addon_x
  64.     @layout0.y = 16 + @addon_y
  65.     @layout1 = Sprite.new(param(:layout1))
  66.     @layout1.z = 203
  67.     @layout1.x = 19 + @addon_x
  68.     @layout1.y = 10 + @addon_y
  69.     @hp = Cache.system(param(:hp_meter))
  70.     @mp = Cache.system(param(:mp_meter))
  71.     @shp = Sprite.new([@hp.width, @hp.height])
  72.     @shp.bitmap.blt(0,0,@hp,Rect.new(0,0,@hp.width.to_p(@actor.hp, @actor.mhp),@hp.height))
  73.     @shp.z = 200
  74.     @shp.x = 42 + @addon_x
  75.     @shp.y = 22 + @addon_y
  76.     @smp = Sprite.new([@mp.width, @mp.height])
  77.     @smp.bitmap.blt(0,0,@mp,Rect.new(0,0,@mp.width.to_p(@actor.mp, @actor.mmp),@mp.height))
  78.     @smp.z = 200
  79.     @smp.x = 44 + @addon_x
  80.     @smp.y = 43 + @addon_y
  81.     @efeito = Sprite.new(param(:layout_effect))
  82.     @efeito.opacity = 128
  83.     @efeito.z = 202
  84.     @efeito.blend_type = param(:blend_type)
  85.     @efeito.x = 42 + @addon_x
  86.     @efeito.y = 22 + @addon_y
  87.   end
  88.   #----------------------------------------------------------------------------
  89.   # • Renovação dos objetos.
  90.   #----------------------------------------------------------------------------
  91.   def dispose
  92.     @layout0.dispose
  93.     @layout1.dispose
  94.     @shp.dispose
  95.     @smp.dispose
  96.     @efeito.dispose
  97.   end
  98.   #----------------------------------------------------------------------------
  99.   # • Atualização dos objetos.
  100.   #----------------------------------------------------------------------------
  101.   def update
  102.     @shp.bitmap.clear
  103.     @smp.bitmap.clear
  104.     @shp.bitmap.blt(0,0,@hp,Rect.new(0,0,@hp.width.to_p(@actor.hp, @actor.mhp),@hp.height))
  105.     @smp.bitmap.blt(0,0,@mp,Rect.new(0,0,@mp.width.to_p(@actor.mp, @actor.mmp),@mp.height))
  106.     trigger?(param(:key)) { $game_system.steam_hud = !$game_system.steam_hud }
  107.     if $game_system.steam_hud
  108.       Opacity.sprite_opacity(@efeito, 2, 122, 62, :efeito_steampunk_hud)
  109.       [@layout0, @layout1, @shp, @smp].each do |variables|
  110.         Opacity.sprite_opacity_out(variables, param(:speed), 255)
  111.       end
  112.     else
  113.       [@layout0, @layout1, @shp, @smp, @efeito].each do |variables|
  114.         Opacity.sprite_opacity_in(variables, param(:speed), 0)
  115.       end
  116.     end
  117.   end
  118. end
  119. #==============================================================================
  120. # • Scene_Map
  121. #==============================================================================
  122. class Scene_Map < Scene_Base
  123.   alias :steampunk_hud_main :main
  124.   def main
  125.     @steampunk_hud = Sprite_Steampunk_Hud.new
  126.     steampunk_hud_main
  127.     @steampunk_hud.dispose
  128.   end
  129.   alias :steampunk_hud_update :update
  130.   def update
  131.     steampunk_hud_update
  132.     @steampunk_hud.update
  133.   end
  134. end
  135.  
  136. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement