Brasil G4mes
Registre-se para ter acesso total à todas as seções do fórum!
Jogue, brinque e o mais importante, divirta-se!

Participe do fórum, é rápido e fácil

Brasil G4mes
Registre-se para ter acesso total à todas as seções do fórum!
Jogue, brinque e o mais importante, divirta-se!
Brasil G4mes
Gostaria de reagir a esta mensagem? Crie uma conta em poucos cliques ou inicie sessão para continuar.

HUD Amneria Simples

2 participantes

Ir para baixo

HUD Amneria Simples Empty HUD Amneria Simples

Mensagem por Brutus_BK Qui Jun 11, 2009 12:04 pm

HUD Amneria Simples


Produzido por: VitorJ
Tópico origina: RMB - HUD Amneria Simples

Introdução:


Um HUD bonitinha, mas muito limitada, pois não mostra tudo que deveria mostrar.

Screen Shot:


HUD Amneria Simples Image3nd2

Instruções:


Apenas cole acima do Main

Script:


Código:
##############################################################
## HUD Amneria[Simple]1.0 Por VitorJ ## Creditos Nescessarios#
##############################################################
## Como Usar: ################################################
############## Cole Acima do main e customize a seu gosto. ###
##############(Ainda pouco Customizavel)######################
##############################################################
module Hud_Edit
  HUDX = 0 # Posição X Das Barra de HP e MP
  HUDY = 10 # Posição Y Das Barra de HP e MP
  SWITCH = 1 # Sitch que mostrara a HUD.
  FONTNAME = "Palatino Linotype" # Fonte das Letras (Não Inclue os Texto de HP e SP)
  EXPX = 0 # Posição X Da Barra de EXP
  EXPY = 472 # Posição Y Da Barra de EXP
end
class Simple_Hud_Sprite < Sprite
  include Hud_Edit
  def initialize(viewport)
    super(viewport)
    self.bitmap = Bitmap.new(640, 480)
    self.bitmap.font.name = FONTNAME
    self.visible = $game_switches[SWITCH]
    start
  end
  def start
    if $game_actors[0] != nil
      actor = $game_actors[0]
    else
      actor = $game_actors[1]
    end
    @actor = actor
    @hp = actor.hp
    @sp = actor.sp
    @maxhp = actor.maxhp
    @maxsp = actor.maxsp
    @name = actor.name
    @level = actor.level
    @exp = actor.exp
    @gold = $game_party.gold.to_s
    draw_hp
    draw_sp
    draw_xp
    #draw_char
    #draw_gold
  end
  def draw_hp
    x = HUDX+8
    y = HUDY
    self.bitmap.fill_rect(Rect.new(x-3, y-6, 115, 18), Color.new(0,0,0,0))
    draw_gradient([0,0,0,255],[0,0,0,255],102,8,x,y)
    draw_gradient([200,183,130,255],[253,209,77,255],100,6,x+2,y+1)
    draw_gradient([0,0,0,100],[0,0,0,170],98,4,x+4,y+2)
    cw = 98  * @hp / @maxhp
    ch = 4
    r = 253 * @hp / @maxhp
    g = 209 * @hp / @maxhp
    b = 77 * @hp / @maxhp
    draw_gradient([0,100,0,255],[r,g,b,255],cw,ch,x+4,y+2)
    rx = 200 * @hp / @maxhp
    draw_hp_text(x-2, y-3,Color.new(rx+55,0,0,255))
    self.bitmap.font.size = 15
    text = "#{@hp} / #{@maxhp}"
    size = self.bitmap.text_size(text)
    c = 255 * @hp / @maxhp
    draw_text(x+50, y-8,size.width,size.height, text,Color.new(255,c,c,255))
  end
  def draw_sp
    x = HUDX+32
    y = HUDY+20
    self.bitmap.fill_rect(Rect.new(x-3, y-6, 115, 18), Color.new(255,0,0,0))
    draw_gradient([0,0,0,255],[0,0,0,255],102,8,x,y)
    draw_gradient([200,183,130,255],[253,209,77,255],100,6,x+2,y+1)
    draw_gradient([0,0,0,100],[0,0,0,170],98,4,x+4,y+2)
    cw = 98  * @sp / @maxsp
    ch = 4
    r = 2 * @sp / @maxsp
    g = 58 * @sp / @maxsp
    b = 218 * @sp / @maxsp
    draw_gradient([67,89,153,255],[r,g,b,255],cw,ch,x+4,y+2)
    draw_sp_text(x-3, y-6,Color.new(0,0,255,255))
    text = "#{@sp} / #{@maxsp}"
    size = self.bitmap.text_size(text)
    self.bitmap.font.size = 15
    draw_text(x+50, y-8,size.width,size.height, text,Color.new(255,255,255,255))
  end
  def draw_xp
    x = EXPX
    y = EXPY
    actor = @actor
    self.bitmap.fill_rect(Rect.new(x, y-6, 640, 15), Color.new(0,0,0,0))
    if actor.next_exp != 0
      rate = actor.now_exp.to_f / actor.next_exp
    else
      rate = 1
    end
    if actor.level < 99
      cw = 638 * rate
    else
      cw = 638
    end 
    ch = 5
    self.bitmap.fill_rect(Rect.new(x, y, 640, 10), Color.new(0,0,0,255))
    self.bitmap.fill_rect(Rect.new(x+1, y+1, 638, 6), Color.new(0,0,0,160))
    draw_gradient([67,153,153,200],[2,218,218,255],cw,ch,x+1,y+1,1)
    self.bitmap.font.size = 15
    text = "Level: #{@level}"
    size = self.bitmap.text_size(text)
    draw_text(x, y-8,size.width,size.height, text,Color.new(255,255,255,255))
  end
  def draw_gradient(cor_ini,cor_fin,width,height,x,y,type=0)
    if width < 1
      width2 = width
      width = 1
    end
    calc0 = cor_fin[0]/width
    calc1 = cor_fin[1]/width
    calc2 = cor_fin[2]/width
    calc3 = cor_fin[3]/width
    width = width2 if width2 != nil
    cor_fin = [calc0,calc1,calc2,calc3]
    r = cor_ini[0]
    g = cor_ini[1]
    b = cor_ini[2]
    o = cor_ini[3]
    for i in 0..width
      for n in 0..height
        self.bitmap.fill_rect(Rect.new(x+i+n, y+n, 1, 1), Color.new(r,g,b,o)) if type == 0
        self.bitmap.fill_rect(Rect.new(x+i, y+n, 1, 1), Color.new(r,g,b,o)) if type == 1
      end
      r += cor_fin[0]
      g += cor_fin[1]
      b += cor_fin[2]
      o += cor_fin[3]
    end
  end
  def draw_text(x,y,width,height,text,color)
    self.bitmap.font.color = Color.new(0,0,0,255)
    self.bitmap.draw_text(Rect.new(x-1, y,width,height), text)
    self.bitmap.draw_text(Rect.new(x+1, y,width,height), text)
    self.bitmap.draw_text(Rect.new(x, y-1,width,height), text)
    self.bitmap.draw_text(Rect.new(x, y+1,width,height), text)
    self.bitmap.font.color = color
    self.bitmap.draw_text(Rect.new(x, y,width,height), text)
  end
  def draw_hp_text(x,y,cor)
    self.bitmap.fill_rect(Rect.new(x, y, 3, 10), Color.new(0,0,0,255))
    self.bitmap.fill_rect(Rect.new(x+3, y+3, 1, 3), Color.new(0,0,0,255))
    self.bitmap.fill_rect(Rect.new(x+4, y, 3, 10), Color.new(0,0,0,255))
    self.bitmap.fill_rect(Rect.new(x+8, y, 6, 6), Color.new(0,0,0,255))
    self.bitmap.fill_rect(Rect.new(x+8, y+6, 3, 4), Color.new(0,0,0,255))
    #=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=
    self.bitmap.fill_rect(Rect.new(x+1, y+1, 1, 8), cor)
    self.bitmap.fill_rect(Rect.new(x+2, y+4, 3, 1), cor)
    self.bitmap.fill_rect(Rect.new(x+5, y+1, 1, 8), cor)
    self.bitmap.fill_rect(Rect.new(x+9, y+1, 1, 8), cor)
    self.bitmap.fill_rect(Rect.new(x+10, y+1, 2, 1), cor)
    self.bitmap.fill_rect(Rect.new(x+12, y+1, 1, 4), cor)
    self.bitmap.fill_rect(Rect.new(x+10, y+4, 2, 1), cor)
  end
  def draw_sp_text(x,y,cor)
    self.bitmap.fill_rect(Rect.new(x, y, 3, 10), Color.new(0,0,0,255))
    self.bitmap.fill_rect(Rect.new(x+3, y+1, 1, 4), Color.new(0,0,0,255))
    self.bitmap.fill_rect(Rect.new(x+4, y, 3, 10), Color.new(0,0,0,255))
    self.bitmap.fill_rect(Rect.new(x+8, y, 6, 6), Color.new(0,0,0,255))
    self.bitmap.fill_rect(Rect.new(x+8, y+6, 3, 4), Color.new(0,0,0,255))
    #=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=
    self.bitmap.fill_rect(Rect.new(x+1, y+1, 1, 8), cor)
    self.bitmap.fill_rect(Rect.new(x+2, y+2, 1, 1), cor)
    self.bitmap.fill_rect(Rect.new(x+3, y+3, 1, 1), cor)
    self.bitmap.fill_rect(Rect.new(x+4, y+2, 1, 1), cor)
    self.bitmap.fill_rect(Rect.new(x+5, y+1, 1, 8), cor)
    self.bitmap.fill_rect(Rect.new(x+9, y+1, 1, 8), cor)
    self.bitmap.fill_rect(Rect.new(x+10, y+1, 2, 1), cor)
    self.bitmap.fill_rect(Rect.new(x+12, y+1, 1, 4), cor)
    self.bitmap.fill_rect(Rect.new(x+10, y+4, 2, 1), cor)
  end
  def update
    if $game_actors[0] != nil
      actor = $game_actors[0]
    else
      actor = $game_actors[1]
    end
    if @hp != actor.hp or @maxhp != actor.maxhp
      @hp = actor.hp
      @maxhp = actor.maxhp
      draw_hp
    end
    if @sp != actor.sp or @maxsp != actor.maxsp
      @sp = actor.sp
      @maxsp = actor.maxsp
      draw_sp
    end
    if @exp != actor.exp or @level != actor.level
      @exp = actor.exp
      @level = actor.level
      draw_xp
    end
    self.visible = $game_switches[SWITCH]
  end
end

class Simple_Hud
  def initialize
    @viewport = Viewport.new(0, 0, 640, 480)
    @viewport.z = 9999
    @simple_hud = Simple_Hud_Sprite.new(@viewport)
    @sprites = []
    @sprites.push(@simple_hud)
    @visible = true
  end
  def update
    for sprite in @sprites
      next if sprite.nil?
      sprite.update
    end
  end
  def dispose
    for sprite in @sprites
      next if sprite.nil?
      sprite.dispose
    end
    @sprites = []
  end
end
#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=
class Scene_Map
  alias simple_hud_main main
  def main
    @hud = Simple_Hud.new
    simple_hud_main
    @hud.dispose
  end
  alias simple_hud_update update
  def update
    @hud.update
    simple_hud_update
  end
end
#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=#=
class Game_Actor < Game_Battler
  def now_exp
    return @exp - @exp_list[@level]
  end
  def next_exp
    return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
  end
end

Se preferir uma Demo: AQUI!
Brutus_BK
Brutus_BK
Membro
Membro

Mensagens Mensagens : 75
Fama Fama : 8

Ir para o topo Ir para baixo

HUD Amneria Simples Empty Re: HUD Amneria Simples

Mensagem por Tyriel Qui Jun 11, 2009 12:47 pm

Bem legal, mas acho que para um minigame ficaria ótimo!
+ Fama
Tyriel
Tyriel
Membro
Membro

Mensagens Mensagens : 566
Fama Fama : 19

Ir para o topo Ir para baixo

HUD Amneria Simples Empty Re: HUD Amneria Simples

Mensagem por Convidad Qui Jun 11, 2009 2:57 pm

mto feia,akela barra de XP ta mto fraca e HP e SP a mesma coisa...

Convidad
Convidado


Ir para o topo Ir para baixo

HUD Amneria Simples Empty Re: HUD Amneria Simples

Mensagem por Conteúdo patrocinado


Conteúdo patrocinado


Ir para o topo Ir para baixo

Ir para o topo

- Tópicos semelhantes

 
Permissões neste sub-fórum
Não podes responder a tópicos