Advertisement
DaxSoft

steampunk_hud

Oct 15th, 2015
1,034
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 7.17 KB | None | 0 0
  1. #==============================================================================
  2. # • Steampunk Hud
  3. #==============================================================================
  4. # Autor: Dax
  5. # Versão: 2.5
  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. Dax.register(:steampunk_hud, "dax", 2.5, [[:plugin_manager, "dax"]]) {
  24. #==============================================================================
  25. # Registrar:plugin
  26. #==============================================================================
  27. plugin_register(:steampunk_hud, "dax", {
  28.   name: "Steampunk Hud",
  29.   version: "2.5",
  30.   description: "Sistema de HUD com Design Steampunk, onde mostra o HP mais o MP.",
  31.   email: "dax-soft@live.com",
  32.   website: "dax-soft.weebly.com"
  33. })
  34. #==============================================================================
  35. # • Exportar:plugin
  36. #==============================================================================
  37. plugin_export(:steampunk_hud, "dax", :X, 0)
  38. plugin_export(:steampunk_hud, "dax", :Y, 0)
  39. #==============================================================================
  40. # • Game_System
  41. #==============================================================================
  42. class Game_System
  43.   attr_accessor :steam_hud
  44.   alias :steam_hud_initialize :initialize
  45.   def initialize
  46.     steam_hud_initialize
  47.     @steam_hud = true
  48.   end
  49. end
  50. #==============================================================================
  51. # • Steampunk_HUD
  52. #==============================================================================
  53. module Steampunk_HUD
  54.   module_function
  55.   #----------------------------------------------------------------------------
  56.   # • Configuração da HUD. Settings of HUD.
  57.   #----------------------------------------------------------------------------
  58.   def steampunk_hud
  59.     return {
  60.       # First layout of HUD.
  61.       layout0: "S: Layout 0 - Back HUD",  # Primeiro layout da HUD.
  62.       # Second layout of HUD.
  63.       layout1: "S: Layout 1 - Icon HUD",  # Segundo layout da HUD.
  64.       # Layout of effect of the HUD.
  65.       layout_effect: "S: Efeito HUD",    # Layout de efeito da HUD.
  66.       # Bar of the HP of the HUD.
  67.       hp_meter: "Hp Meter HUD",       # Barra de HP da HUD.
  68.       # Bar of the MP of the HUD.
  69.       mp_meter: "Mp Meter HUD",       # Barra de MP da HUD.
  70.       # What the kind of 'lend' to the effect?
  71.       blend_type: 1,                    # Qual o tipo de 'blend' para o efeito?
  72.       # Speed in the what the HUD will hide/active.
  73.       speed: 4,                       # Velocidade na qual a HUD irá esconder/ativar
  74.       # The HUD is destined to what Character?
  75.       actor_id: 1,                    # A HUD é destinada a qual Actor?
  76.       # Key to hide/show HUD.
  77.       key: :D                     # Chave para esconder/ativar HUD.
  78.     }
  79.   end
  80. end
  81. #==============================================================================
  82. # • Sprite_Steampunk_Hud
  83. #==============================================================================
  84. class Sprite_Steampunk_Hud
  85.   #----------------------------------------------------------------------------
  86.   # • Inicialização dos objetos.
  87.   #----------------------------------------------------------------------------
  88.   def initialize
  89.     @addon_x = plugin_import(:X, :steampunk_hud, "dax")
  90.     @addon_y = plugin_import(:Y, :steampunk_hud, "dax")
  91.     @actor = $game_actors[Steampunk_HUD.steampunk_hud[:actor_id]]
  92.     @layout0 = Sprite.new(Steampunk_HUD.steampunk_hud[:layout0])
  93.     @layout0.z = 200
  94.     @layout0.x = 30 + @addon_x
  95.     @layout0.y = 16 + @addon_y
  96.     @layout1 = Sprite.new(Steampunk_HUD.steampunk_hud[:layout1])
  97.     @layout1.z = 203
  98.     @layout1.x = 19 + @addon_x
  99.     @layout1.y = 10 + @addon_y
  100.     @hp = Cache.system(Steampunk_HUD.steampunk_hud[:hp_meter])
  101.     @mp = Cache.system(Steampunk_HUD.steampunk_hud[:mp_meter])
  102.     @shp = Sprite.new([@hp.width, @hp.height])
  103.     @shp.bitmap.blt(0,0,@hp,Rect.new(0,0,@hp.width.to_p(@actor.hp, @actor.mhp),@hp.height))
  104.     @shp.z = 200
  105.     @shp.x = 42 + @addon_x
  106.     @shp.y = 22 + @addon_y
  107.     @smp = Sprite.new([@mp.width, @mp.height])
  108.     @smp.bitmap.blt(0,0,@mp,Rect.new(0,0,@mp.width.to_p(@actor.mp, @actor.mmp),@mp.height))
  109.     @smp.z = 200
  110.     @smp.x = 44 + @addon_x
  111.     @smp.y = 43 + @addon_y
  112.     @efeito = Sprite.new(Steampunk_HUD.steampunk_hud[:layout_effect])
  113.     @efeito.opacity = 128
  114.     @efeito.z = 202
  115.     @efeito.blend_type = Steampunk_HUD.steampunk_hud[:blend_type]
  116.     @efeito.x = 42 + @addon_x
  117.     @efeito.y = 22 + @addon_y
  118.   end
  119.   #----------------------------------------------------------------------------
  120.   # • Renovação dos objetos.
  121.   #----------------------------------------------------------------------------
  122.   def dispose
  123.     @layout0.dispose
  124.     @layout1.dispose
  125.     @shp.dispose
  126.     @smp.dispose
  127.     @efeito.dispose
  128.   end
  129.   #----------------------------------------------------------------------------
  130.   # • Atualização dos objetos.
  131.   #----------------------------------------------------------------------------
  132.   def update
  133.     @shp.bitmap.clear
  134.     @smp.bitmap.clear
  135.     @shp.bitmap.blt(0,0,@hp,Rect.new(0,0,@hp.width.to_p(@actor.hp, @actor.mhp),@hp.height))
  136.     @smp.bitmap.blt(0,0,@mp,Rect.new(0,0,@mp.width.to_p(@actor.mp, @actor.mmp),@mp.height))
  137.     trigger?(Steampunk_HUD.steampunk_hud[:key]) { $game_system.steam_hud = !$game_system.steam_hud }
  138.     if $game_system.steam_hud
  139.       Opacity.sprite_opacity(@efeito, 2, 122, 62, :efeito_steampunk_hud)
  140.       [@layout0, @layout1, @shp, @smp].each do |variables|0
  141.         Opacity.sprite_opacity_out(variables, Steampunk_HUD.steampunk_hud[:speed], 255)
  142.       end
  143.     else
  144.       [@layout0, @layout1, @shp, @smp, @efeito].each do |variables|
  145.         Opacity.sprite_opacity_in(variables, Steampunk_HUD.steampunk_hud[:speed], 0)
  146.       end
  147.     end
  148.   end
  149. end
  150. #==============================================================================
  151. # • Scene_Map
  152. #==============================================================================
  153. class Scene_Map < Scene_Base
  154.   alias :steampunk_hud_main :main
  155.   def main
  156.     @steampunk_hud = Sprite_Steampunk_Hud.new
  157.     steampunk_hud_main
  158.     @steampunk_hud.dispose
  159.   end
  160.   alias :steampunk_hud_update :update
  161.   def update
  162.     steampunk_hud_update
  163.     @steampunk_hud.update
  164.   end
  165. end
  166.  
  167. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement