🤔 Para Refletir : "Games do sonhos ficam ali, nos sonhos, faca o game do hoje" - codingkitsune

[Ace] Lander Hud

Membro Membro
Postagens
206
Bravecoins
148
Lander Hud
Script original por Highlander, conversão por Takkun.

HUD.png

Ruby:
#==============================================================================#
#Lander_HUD
#Créditos: Highlander
#==============================================================================#

#==============================================================================#
#Configurações
#==============================================================================#
  Posição_X = 0
  Posição_Y = 0
 
  Pasta_das_Imagens_da_HUD = "Graphics/Pictures/"
  Fundo_da_HUD = "HUD.png"
  Barra_de_HP = "HP.png"
  Barra_de_MP = "MP.png"
 
  Utilizar_transparencia_na_entrada = true
  Utilizar_transparencia_na_saida = true
                                        
  Velocidade = 3
  Opacidade_Final = 255
  Opacidade_Final_dos_Elementos = 255
  Opacidade_Personagem = 150
  Opacidade_Personagem_dos_Elementos = 160
                                          
 
  Switch_de_controle = 1 # Switch que controla a HUD entre ON e OFF
                        
                        
  Número_do_Personagem = 1 # Número dele no menu
                          

#==============================================================================#
#Arquivos contidos na HUD
#==============================================================================#
#===============#
#Exibir Char    #
#===============#
  Char_Mostrar = true
  Char_X = 75
  Char_Y = 45
 
#===============#
#Exibir Nome    #
#===============#
  Nome_Mostrar = true
  Nome_Alinhamento = 1
  Nome_X = 10
  Nome_Y = 45
  Nome_Largura = 134
  Nome_Cor = Color.new(255,255,255,255)
  Nome_Fonte = "Georgia"
  Nome_Tamanho_da_Fonte = 18

#===============#
#Exibir HP      #
#===============#
  HP_Mostrar = true
  HP_X = 19
  HP_Y = 34
 
#===============#
#Exibir MP      #
#===============#
  MP_Mostrar = true
  MP_X = 19
  MP_Y = 34
  
#===============#
#Exibir LVL     #
#===============#
  LV_Mostrar = true
  LV_Cor = Color.new(255,255,255,255)
  LV_Fonte = "Georgia"
  LV_Tamanho_da_Fonte = 19
  LV_Largura = 30
  LV_X = 115
  LV_Y = 15

#==============================================================================#
#Fim das Configurações
#==============================================================================#

class Scene_Map < Scene_Base

  alias hud_start start
  alias hud_update update
  alias hud_terminate terminate
 
  def start
    active_hud
    hud_start
  end
 
  def active_hud
    $game_switches[Switch_de_controle] = true
    @animation_hud1 = Utilizar_transparencia_na_entrada
    @animation_hud2 = Utilizar_transparencia_na_entrada
    @animation_hud_1 = Utilizar_transparencia_na_saida
    @animation_hud_2 = Utilizar_transparencia_na_saida
    @back = Sprite.new
    @back.bitmap = Cache.load_bitmap(Pasta_das_Imagens_da_HUD, Fundo_da_HUD)
    @back.opacity = 0 if @animation_hud1 == true
    x = Posição_X
    y = Posição_Y
    w = @back.width
    h = @back.height
    x = ( x == nil ? ( 544 - w ) / 2 : ( x < 0 ? ( 544 + x - w ) : x ) )
    y = ( y == nil ? ( 416 - h ) / 2 : ( y < 0 ? ( 416 + y - h ) : y ) )
    @back.x = x
    @back.y = y
    @back.z = 190
    @wind = Window_Base.new(x-16,y-16,w+32,h+32)
    @wind.opacity = 0
    @wind.contents_opacity = 0 if @animation_hud2 == true
    @wind.z = 195
    @wind.contents.font.shadow = true
    @id = Número_do_Personagem-1
    @info = []
    @hp = Sprite.new
    @hp.bitmap = Bitmap.new(32,32)
    @mp = Sprite.new
    @mp.bitmap = Bitmap.new(32,32)
    @hp.x = HP_X + x
    @mp.x = MP_X + x
    @hp.y = HP_Y + y
    @mp.y = MP_Y + y
    @hp.z = 192
    @mp.z = 193
    @hp.opacity = 0 if @animation_hud2 == true
    @mp.opacity = 0 if @animation_hud2 == true
    real_update if condição_de_atualização
  end
 
  def terminate
    if @animation_hud_1 == true
      @back.bitmap.dispose
      @back.dispose
    end
    if @animation_hud_2 == true
      @hp.bitmap.dispose
      @hp.dispose
      @mp.bitmap.dispose
      @mp.dispose
      @wind.contents.dispose
      @wind.dispose
    end
    hud_terminate
  end
 
  def update
    if $game_switches[Switch_de_controle] == true
      if @back != nil
        if @back.opacity < Opacidade_Final and @animation_hud1 == true
          @back.opacity += Velocidade
        else
          @back.opacity = Opacidade_Final
          @animation_hud1 = false
        end
        if @wind.contents_opacity < Opacidade_Final_dos_Elementos and @animation_hud2 == true
          @wind.contents_opacity += Velocidade
          @hp.opacity += Velocidade
          @mp.opacity += Velocidade
        else
          @wind.contents_opacity = Opacidade_Final_dos_Elementos
          @hp.opacity = Opacidade_Final_dos_Elementos
          @mp.opacity = Opacidade_Final_dos_Elementos
          @animation_hud2 = false
        end
      else
        active_hud
      end
    else
      if @back != nil
        if @back.opacity > Velocidade-1 and @animation_hud_1 == true
          @back.opacity -= Velocidade
        else
          @back.bitmap.dispose
          @back.dispose
          @back = nil
          @animation_hud_1 = false
        end
        if @wind.contents_opacity > Velocidade-1 and @animation_hud_2 == true
          @wind.contents_opacity -= Velocidade
          @hp.opacity -= Velocidade
          @mp.opacity -= Velocidade
        else
          if @animation_hud_2 == true
            @hp.bitmap.dispose
            @hp.dispose
            @hp = nil
            @mp.bitmap.dispose
            @mp.dispose
            @mp = nil
            @wind.contents.dispose
            @wind.dispose
            @wind = nil
            @animation_hud_2 = false
          end
        end
      end
    end
    if @back != nil
      if $game_player.screen_x >= @back.x and $game_player.screen_x <= @back.x + @back.width and
         $game_player.screen_y >= @back.y and $game_player.screen_y <= @back.y + @back.height
        @back.opacity = Opacidade_Personagem
        @hp.opacity = Opacidade_Personagem_dos_Elementos
        @mp.opacity = Opacidade_Personagem_dos_Elementos
        @wind.contents_opacity = Opacidade_Personagem_dos_Elementos
      end
    end
    real_update if condição_de_atualização
    hud_update
  end
 
  def real_update
    a = $game_party.members[@id]
    @wind.contents.clear
    @wind.draw_character(a.character_name, a.character_index, Char_X, Char_Y) if Char_Mostrar
     if Nome_Mostrar
      @wind.contents.font.name = Nome_Fonte if Nome_Fonte != nil
      @wind.contents.font.color = Nome_Cor
      @wind.contents.font.size = Nome_Tamanho_da_Fonte
      @wind.contents.draw_text(Nome_X, Nome_Y, Nome_Largura, Nome_Tamanho_da_Fonte, a.name, Nome_Alinhamento)
    end
    if HP_Mostrar
      @hp.bitmap.dispose
      @hp.bitmap = Cache.load_bitmap(Pasta_das_Imagens_da_HUD, Barra_de_HP)
      @hp.bitmap.clear_rect(Rect.new((@hp.width*a.hp/a.mhp),0,@hp.width,@hp.height))
    end
    if MP_Mostrar
      @mp.bitmap.dispose
      @mp.bitmap = Cache.load_bitmap(Pasta_das_Imagens_da_HUD, Barra_de_MP)
      @mp.bitmap.clear_rect(Rect.new((@mp.width*a.mp/a.mmp),0,@mp.width,@mp.height))
    end
    if LV_Mostrar
      @wind.contents.font.name = LV_Fonte if LV_Fonte != nil
      @wind.contents.font.color = LV_Cor
      @wind.contents.font.size = LV_Tamanho_da_Fonte
      @wind.contents.draw_text(LV_X, LV_Y, LV_Largura, LV_Tamanho_da_Fonte, a.level, 1)
    end
  end
 
  def condição_de_atualização
    return false if @wind == nil
    a = $game_party.members[@id]
    return update_infos if a.id != @info[0]
    return update_infos if a.character_name != @info[1]
    return update_infos if a.character_index != @info[2]
    return update_infos if a.name != @info[3]
    return update_infos if a.hp != @info[4]
    return update_infos if a.mhp != @info[5]
    return update_infos if a.mp != @info[6]
    return update_infos if a.mmp != @info[7]
    return update_infos if a.level != @info[8]
    return false
  end
 
  def update_infos
    a = $game_party.members[@id]
    @info[0] = a.id
    @info[1] = a.character_name
    @info[2] = a.character_index
    @info[3] = a.name
    @info[4] = a.hp
    @info[5] = a.mhp
    @info[6] = a.mp
    @info[7] = a.mmp
    @info[8] = a.level

    return true
  end
 
end

 
Voltar
Topo