Moura Admin
Mensagens : 26 Reputação : 1 Data de inscrição : 23/07/2011 Idade : 27 Localização : Amapá
| Assunto: HUD - God of War II Qua Jul 27, 2011 2:46 am | |
| - Código:
-
X = 0 Y = 0 Largura = 343 Altura = 148 class Hud < Window_Base def initialize super(X,Y,Largura,Altura) self.contents = Bitmap.new(width - 32, height - 32) self.windowskin = RPG::Cache.windowskin("Skin") @ator = 0 refresh end
def refresh self.contents.clear actor = $game_party.actors[0] hud3 = RPG::Cache.picture("HUD") hud1 = hud3.width hud2 = hud3.height hud4 = Rect.new(0,0,hud1,hud2) self.contents.blt(0,0,hud3,hud4) #Conteúdo: draw_actor_hp_bar_1(actor, 74, 33) draw_actor_sp_bar_1(actor, 74, 43) #Fim if $scene.is_a?(Scene_Menu) self.contents.clear end if $scene.is_a?(Scene_Battle) self.contents.clear self.visible = false end end end #Adiciona a janela a o mapa. class Scene_Map alias hud_main main def main @Hud = Hud.new hud_main @Hud.dispose end alias hud_update update def update hud_update @Hud.update @Hud.refresh end end
class Window_Base < Window def draw_face (actor, x, y) bitmap = RPG::Cache.picture(actor.name + "_face") cw = bitmap.width ch = bitmap.height src_rect = Rect.new(0, 0, cw, ch) self.contents.blt(x -cw / 2 , y - ch,bitmap, src_rect) end def draw_actor_hp_bar_1(actor, x, y) back = RPG::Cache.picture("Barra_Fundo") cw = back.width ch = back.height src_rect = Rect.new(0, 0, cw, ch) self.contents.blt(x + 65, y - ch + 30, back, src_rect) meter = RPG::Cache.picture("Barra_Hp") cw = meter.width * actor.hp / actor.maxhp ch = meter.height src_rect = Rect.new(0, 0, cw, ch) self.contents.blt(x + 65, y - ch + 30, meter, src_rect) end def draw_actor_sp_bar_1(actor, x, y) back = RPG::Cache.picture("Barra_Fundo") cw = back.width ch = back.height src_rect = Rect.new(0, 0, cw, ch) self.contents.blt(x + 65, y - ch + 30, back, src_rect) meter = RPG::Cache.picture("Barra_Sp") cw = meter.width * actor.sp / actor.maxsp ch = meter.height src_rect = Rect.new(0, 0, cw, ch) self.contents.blt(x + 65, y - ch + 30, meter, src_rect) end end
Baixar Demo! | |
|