UltimaForum

Wsparcie [VX] - HUD

Flanagan - Nie 26 Gru, 2010 17:04
Temat postu: HUD
Witam, dziś proszę was o hud który by był na samym dole gry rozkładał się na cału dolny ekran czyli:
( -ekran
[ -hud

([ ])


i były tam tylko paski: hp,mp,exp
W takich kolorach jakie opisałem z góry dziękuję za pomoc i pomógł ;-)

Edit: żadnych lvli czy imion tylko te paski

Ayene - Pią 31 Gru, 2010 14:32

Sprawdź to:
Spoiler:

Kod:
# HUD HP/MP/EXP

module Ayene
  HUD_SWITCH_ID = 1 # jeśli przełącznik jest włączony, to HUD niewidoczny
end

class Window_MapHUD < Window_Base
 
  def initialize(index)
    @index = index
    super(0, 360, 544, WLH + 32)     
    self.visible = !$game_switches[Ayene::HUD_SWITCH_ID]
    self.opacity = 255
    @actor = $game_party.members[@index]
    refresh
  end
 
  def refresh
    self.contents.clear
    @hp = @actor.hp
    @mp = @actor.mp
    @exp = @actor.exp
    draw_actor_hp(@actor, 0, WLH * 0, 120)
    draw_actor_mp(@actor, 195, WLH * 0, 120)
    draw_actor_exp_HUD(@actor, 390, WLH * 0, 120)
  end
 
  def draw_actor_exp_HUD(actor, x, y, width)
    s1 = actor.level == 99 ? 1 : actor.now_exp
    s2 = actor.level == 99 ? 1 : actor.next_exp 
    draw_actor_exp_gauge(actor, x, y, s1, s2, width)
    self.contents.font.color = system_color
    self.contents.draw_text(x, y, 30, WLH, "E")
    self.contents.font.color = normal_color
    self.contents.draw_text(x + width - 120, y, 120, WLH, actor.exp_s , 2)   
  end
 
  def draw_actor_hp_gauge(actor, x, y, width = 120)
    gw = width * actor.hp / actor.maxhp
    gc1 = Color.new(255, 0, 0)
    gc2 = Color.new(255, 121, 121)
    self.contents.fill_rect(x, y + WLH - 9, width + 2, 8, gauge_back_color)
    self.contents.gradient_fill_rect(x+1, y + WLH - 8, gw, 6, gc1, gc2)
  end
 
  def draw_actor_mp_gauge(actor, x, y, width = 120)
    gw = width * actor.mp / actor.maxmp
    gc1 = Color.new(0, 0, 255)
    gc2 = Color.new(121, 121, 255)
    self.contents.fill_rect(x, y + WLH - 9, width + 2, 8, gauge_back_color)
    self.contents.gradient_fill_rect(x+1, y + WLH - 8, gw, 6, gc1, gc2)
  end
 
  def draw_actor_exp_gauge(actor, x, y, s1, s2, width = 120)
    gw = width * s1 / s2
    gc1 = Color.new(0, 255, 0)
    gc2 = Color.new(121, 255, 121)
    self.contents.fill_rect(x, y + WLH - 9, width + 2, 8, gauge_back_color)
    self.contents.gradient_fill_rect(x+1, y + WLH - 8, gw, 6, gc1, gc2)
  end
 
  def update
    self.visible = !$game_switches[Ayene::HUD_SWITCH_ID]
    return if !self.visible
    if @hp != @actor.hp or @mp != @actor.mp or @exp != @actor.exp     
      refresh
    end
  end
end

class Scene_Map < Scene_Base
  alias aye_scmap_hud_start start
  alias aye_scmap_hud_ter terminate
  alias aye_scmap_hud_update update
  def start
    aye_scmap_hud_start
    @actor_index = 0
    @hud_window = Window_MapHUD.new(@actor_index)   
  end
  def terminate
    @hud_window.dispose
    aye_scmap_hud_ter
  end
  def update
    aye_scmap_hud_update
    @hud_window.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


Itaki - Pią 31 Gru, 2010 17:25

Ehh ale po rozmowie to znika :/.
Flanagan - Pią 31 Gru, 2010 18:03

skrypt jest dobry dzięki ayene jak zawsze wielka :P
Angius - Pią 31 Gru, 2010 21:26

Możnaby jakiś screen prosić? Chętnie bym to zobaczył, sam szukam jakiegoś HUDa pasków :)
Drawestien - Pią 31 Gru, 2010 23:51

Screnn
Spoiler:



Powered by phpBB modified by Przemo © 2003 phpBB Group