Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ~ Akian~RGSS3 ~
- # =============================== Español ======================================
- # Nombre del script: AR3 ~ Advanced Hud
- # Scripter: Akian~RGSS3
- # Requiere?: Imagenes del demo
- # Versión: 1.0
- # Historial:
- # 1.0 Comienzo y Finalización del script
- # Este script te permite un hud altamente modificable a base de sprites.
- # Contiene técnicas de scripteo avanzado (si eres scripter puedes revisarlas
- # para enterarte de cómo se logra algo así).
- # Puedes cambiar las imágenes (deben mantener el mismo nombre) a tu gusto
- # así podrás armar el hud como tu quieras, o simplemente modifica la posición
- # de las imágenes por default en la region editable.
- # ~ Script call ~
- # hud_visible(true) para activar el hud
- # hud_visible(false) para desactivarlo
- #===============================================================================
- # Condiciones de uso:
- # Puedes usar libremente este script en proyectos comerciales y no comerciales
- # Los créditos son requeridos, por el trabajo, el esfuerzo, el sudor, bueno no
- # tanto por el sudor.
- # Si posteas este script en algún foro debes señalar la página oficial
- # http://akianrgss3.wordpress.com/
- # También nombrar la página en los créditos si lo usas para un proyecto.
- # NO puedes usar las imágenes del demo en un proyecto comercial.
- #===============================================================================
- # =============================== English ======================================
- # Name of the script: AR3 ~ Advanced Hud
- # Scripter: Akian~RGSS3
- # Need?: Images from the demo
- # Versión: 1.0
- # Historial:
- # 1.0 Start and finish the script
- # This script allows a hud on the map with advanced techniques on sprites.
- # You can change the images on Graphics/Advanced_Hud folder and the position
- # in the editable region below to make your own hud.
- # ~ Script call ~
- # hud_visible(true) to enable the hud
- # hud_visible(false) to disable the hud
- #===============================================================================
- # Terms of use:
- # Free to use in comercial and non comercial projects
- # Credits are required and the mention of my web
- # http://akianrgss3.wordpress.com/
- # also you has to mention my page if you post this script in other web/blog
- # Sry for this, but you are NOT allowed to use the images from the demo
- # in a comercial project.
- #===============================================================================
- $imported = {} if $imported.nil?
- $imported["AR3_Advanced_Hud"] = true
- module AR3_ADVANCED_HUD
- #===============================================================================
- #
- # REGION EDITABLE
- #
- #===============================================================================
- #~~~~~~~~~~~~~~~~~~
- # Hud
- #~~~~~~~~~~~~~~~~~~
- # Posición x del hud | x position
- HUD_POSITION_X = -5
- # Posición y del hud | y position
- HUD_POSITION_Y = -5
- # Visible desde el inicio? | initial visible?
- # true = yes
- # false = no
- INITIAL_VISIBLE = true
- # Posición z del hud
- HUD_Z = 70
- #~~~~~~~~~~~~~~~~~~
- # Face
- #~~~~~~~~~~~~~~~~~~
- # Mostrar la cara del personaje? true / false
- # Para esto se necesitara una imagen en la carpeta Graphics/Advanced_Hud
- # con la cara del actor y debe obligadamente tener el siguiente nombre
- # ACTOR_ID + _Face
- # Ex: Actor1_Face Actor2_Face etc
- # Show face graphic? true / false
- # You will need the face image of the actor and name it ACTOR_ID + _Face
- # Ex: Actor1_Face Actor2_Face etc
- DRAW_FACE = true
- # Posición x de la cara | x position
- FACE_POSITION_X = 3
- # Posición y de la cara | y position
- FACE_POSITION_Y = 12
- #~~~~~~~~~~~~~~~~~~
- # Hp
- #~~~~~~~~~~~~~~~~~~
- # Mostrar barra de vida? true / false
- # Show hp bar? true / false
- DRAW_HP = true
- # Posición x de la barra de vida | x position
- HP_POSITION_X = 95
- # Posición y de la barra de vida | y position
- HP_POSITION_Y = 57
- #~~~~~~~~~~~~~~~~~~
- # Mp
- #~~~~~~~~~~~~~~~~~~
- # Mostrar barra de mp? true / false
- # Show mp bar? true / false
- DRAW_MP = true
- # Posición x de la barra de mp | x position
- MP_POSITION_X = 83
- # Posición y de la barra de mp | y position
- MP_POSITION_Y = 78
- #~~~~~~~~~~~~~~~~~~
- # Level
- #~~~~~~~~~~~~~~~~~~
- # Mostrar Nivel? true / false
- # Show level? true / false
- LV_SPRITE = true
- # Posición x de la capa (layer) | level layer position x
- LV_POSITION_X = 60
- # Posición y de la capa (layer) | level layer position y
- LV_POSITION_Y = 87
- # Posición x del número para el nivel | level number position x
- LEVEL_NUMBER_POSITION_X = 95
- # Posición y del número para el nivel | level number position y
- LEVEL_NUMBER_POSITION_Y = 108
- #~~~~~~~~~~~~~~~~~~
- # Hp Mp
- #~~~~~~~~~~~~~~~~~~
- # Mostrar gráfico Hp_Mp? true / false
- # Show words of Hp_Mp? true / false
- DRAW_WORD = true
- # Posición x del Hp_Mp | x position
- WORD_POSITION_X = 88
- # Posición x del Hp_Mp | y position
- WORD_POSITION_Y = 50
- #~~~~~~~~~~~~~~~~~~
- # Nombre
- #~~~~~~~~~~~~~~~~~~
- # Mostrar nombre del personaje? true / false
- # Show name? true / false
- DRAW_NAME = true
- # Posición x del nombre | x position
- NAME_POSITION_X = 110
- # Posición y del nombre | y position
- NAME_POSITION_Y = 10
- # Fuente del nombre | name font
- NAME_FONT = "Georgia"
- # Tamaño de fuente | font size
- NAME_FONT_SIZE = 18
- # Italic a la fuente? | font italic?
- NAME_FONT_ITALIC = true
- # Bold a la fuente? | font bold?
- NAME_FONT_BOLD = true
- # Color de la fuente rojo verde azul gris
- # Font color
- NAME_FONT_COLOR = Color.new(255, 255, 255, 255)
- # Sombra del nombre?
- # Name shadow?
- NAME_SHADOW = true
- # Color de la sombra? rojo verde azul gris
- # Shadow color
- NAME_SHADOW_FONT_COLOR = Color.new(100, 100, 100, 255)
- #~~~~~~~~~~~~~~~~~~
- # Número Hp
- #~~~~~~~~~~~~~~~~~~
- # Mostrar número de hp? true / false
- # Show hp number? true / false
- DRAW_HP_NUMBER = true
- #~~~~~~~~~~~~~~~~~~
- # Número Mp
- #~~~~~~~~~~~~~~~~~~
- # Mostrar número de mp? true / false
- # Show mp number? true / false
- DRAW_MP_NUMBER = true
- #~~~~~~~~~~~~~~~~~~
- # Oro
- #~~~~~~~~~~~~~~~~~~
- # Mostrar oro? true / false
- # Show gold? true / false
- DRAW_GOLD = true
- # Posición x del oro | x position
- GOLD_POSITION_X = 372
- # Posición y del oro | y position
- GOLD_POSITION_Y = 350
- # Posición x del número del oro | x position of the number
- GOLD_NUMBER_X = 542
- # Posición y del número del oro | y position of the number
- GOLD_NUMBER_Y = 395
- #===============================================================================
- #
- # FIN DE LA REGION EDITABLE
- #
- #===============================================================================
- end
- if true # Set this to true to enable the script
- # Deja en true para activar el script
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # Modulo Cache
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- module Cache
- #--------------------------------------------------------------------------
- # ▼ Cache Advanced_Hud
- #--------------------------------------------------------------------------
- def self.advanced_hud(filename)
- load_bitmap("Graphics/Advanced_Hud/", filename)
- end
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # Seteando acceso a la visibilidad del hud
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- class Game_System
- alias akian_advanced_hud_visible_zack initialize
- attr_accessor :hud_visible
- def initialize
- akian_advanced_hud_visible_zack
- @hud_visible = AR3_ADVANCED_HUD::INITIAL_VISIBLE
- end
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # Clase para los scripts calls
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- class Game_Interpreter
- def hud_visible(valor)
- $game_system.hud_visible = valor
- end
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # Clase Scene_Map donde se ejecuta todo lo relacionado a la escena
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- class Spriteset_Map
- alias akian_avanced_hud_start_zack initialize
- alias akian_advanced_hud_update_zack update
- alias akian_advanced_hud_dispose_zack dispose
- #--------------------------------------------------------------------------
- # ▼ Creando el hud en el mapa
- #--------------------------------------------------------------------------
- def initialize
- create_advanced_hud
- akian_avanced_hud_start_zack
- end
- #--------------------------------------------------------------------------
- # ▼ Dispose
- #--------------------------------------------------------------------------
- def dispose
- execute_hud_dispose
- akian_advanced_hud_dispose_zack
- end
- #--------------------------------------------------------------------------
- # ▼ Actualización
- #--------------------------------------------------------------------------
- def update
- advanced_hud_update
- akian_advanced_hud_update_zack
- end
- #--------------------------------------------------------------------------
- # ▼ Creando hud
- #--------------------------------------------------------------------------
- def create_advanced_hud
- @advanced_hud = Advanced_Hud.new
- end
- #--------------------------------------------------------------------------
- # ▼ Actualización del hud
- #--------------------------------------------------------------------------
- def advanced_hud_update
- return if @advanced_hud == nil
- @advanced_hud.update
- end
- #--------------------------------------------------------------------------
- # ▼ Ejecutando el dispose
- #--------------------------------------------------------------------------
- def execute_hud_dispose
- return if @advanced_hud == nil
- @advanced_hud.dispose
- @advanced_hud = nil
- end
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # Advanced_Hud creación de sprites
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- class Advanced_Hud
- include AR3_ADVANCED_HUD
- #--------------------------------------------------------------------------
- # ▼ Inicializando - seteando el hud
- #--------------------------------------------------------------------------
- def initialize
- setup_start
- create_hud
- end
- #--------------------------------------------------------------------------
- # ▼ Seteando el comienzo
- #--------------------------------------------------------------------------
- def setup_start
- @actor = $game_party.members[0]
- @hp_meter_image = Cache.advanced_hud("Hp_Meter")
- @hp_meter_cw = @hp_meter_image.width
- @hp_meter_ch = @hp_meter_image.height
- @mp_meter_image = Cache.advanced_hud("Mp_Meter")
- @mp_meter_cw = @mp_meter_image.width
- @mp_meter_ch = @mp_meter_image.height
- @lv_number_image = Cache.advanced_hud("Number2")
- @lv_number_cw = @lv_number_image.width / 10
- @lv_number_ch = @lv_number_image.height
- @hp_number_image = Cache.advanced_hud("Number")
- @hp_number_cw = @hp_number_image.width / 10
- @hp_number_ch = @hp_number_image.height
- @mp_number_image = Cache.advanced_hud("Number")
- @mp_number_cw = @mp_number_image.width / 10
- @mp_number_ch = @mp_number_image.height
- @gold_number_image = Cache.advanced_hud("Gold_Number")
- @gold_number_cw = @gold_number_image.width / 10
- @gold_number_ch = @gold_number_image.height
- end
- #--------------------------------------------------------------------------
- # ▼ Creando sprites
- #--------------------------------------------------------------------------
- def create_hud
- create_hud_initial
- hp_meter
- mp_meter
- create_level_number
- create_face
- create_lv_sprite
- create_word
- create_name
- create_hp_number
- create_mp_number
- create_gold_number
- create_gold
- end
- #--------------------------------------------------------------------------
- # ▼ Visibilidad
- #--------------------------------------------------------------------------
- def visible?
- return false if $game_system.hud_visible
- return true
- end
- end
- #===============================================================================
- # Creando hud inicial
- #===============================================================================
- class Advanced_Hud
- def create_hud_initial
- @hud_initial = Sprite.new
- @hud_initial.bitmap = Cache.advanced_hud("Hud")
- @hud_initial.x = HUD_POSITION_X
- @hud_initial.y = HUD_POSITION_Y
- @hud_initial.z = HUD_Z - 3
- @hud_initial.opacity = 0 if visible?
- end
- def refresh_hud_initial
- @hud_initial.opacity -= 5 if visible?
- @hud_initial.opacity += 5 if !visible?
- end
- end
- #===============================================================================
- # Creando Barra de Vida
- #===============================================================================
- class Advanced_Hud
- def hp_meter
- return if !DRAW_HP
- @hp_meter = Sprite.new
- @hp_meter.bitmap = Bitmap.new(@hp_meter_cw,@hp_meter_ch)
- @hp_meter.z = HUD_Z + 4
- @hp_meter.x = HUD_POSITION_X + HP_POSITION_X
- @hp_meter.y = HUD_POSITION_Y + HP_POSITION_Y
- @hp_meter.opacity = 0 if visible?
- end
- #--------------------------------------------------------------------------
- # ▼ Actualizando barra de vida
- #--------------------------------------------------------------------------
- def refresh_hp
- return if !DRAW_HP
- @hp_meter.bitmap.clear
- meter_width = @hp_meter_cw * @actor.hp / @actor.mhp rescue nil
- meter_width = 0 if meter_width == nil
- meter_src_rect = Rect.new(0, 0 , meter_width, @hp_meter_ch)
- @hp_meter.bitmap.blt(0, 0, @hp_meter_image, meter_src_rect)
- @hp_meter.opacity -= 5 if visible?
- @hp_meter.opacity += 5 if !visible?
- end
- end
- #===============================================================================
- # Creando Número Hp
- #===============================================================================
- class Advanced_Hud
- def create_hp_number
- return if !DRAW_HP_NUMBER
- @hp_number = Sprite.new
- @hp_number.bitmap = Bitmap.new(@hp_number_cw * 4, @hp_number_ch)
- @hp_number.x = HUD_POSITION_X + HP_POSITION_X + 103
- @hp_number.y = HUD_POSITION_Y + HP_POSITION_Y + 5
- @hp_number.z = HUD_Z + 6
- @hp_number.zoom_y = 0.7
- @hp_number.opacity = 0 if visible?
- end
- #--------------------------------------------------------------------------
- # ▼ Actualizando número hp
- #--------------------------------------------------------------------------
- def refresh_hp_number
- return if !DRAW_HP_NUMBER
- @hp_number.bitmap.clear
- @old_number = @actor.hp
- number_value = @actor.hp.to_s.split(//)
- for r in 0..number_value.size - 1
- number_value_abs = number_value[r].to_i
- nsrc_rect = Rect.new(@hp_number_cw * number_value_abs, 0 , @hp_number_cw, @hp_number_ch)
- @hp_number.bitmap.blt(@hp_number_cw * r, 0, @hp_number_image, nsrc_rect)
- end
- @hp_number.opacity -= 5 if visible?
- @hp_number.opacity += 5 if !visible?
- @hp_number.x = HUD_POSITION_X + HP_POSITION_X + 103 - (@hp_number_cw * number_value.size)
- end
- end
- #===============================================================================
- # Creando Barra de MP
- #===============================================================================
- class Advanced_Hud
- def mp_meter
- return if !DRAW_MP
- @mp_meter = Sprite.new
- @mp_meter.bitmap = Bitmap.new(@mp_meter_cw, @mp_meter_ch)
- @mp_meter.z = HUD_Z + 4
- @mp_meter.x = HUD_POSITION_X + MP_POSITION_X
- @mp_meter.y = HUD_POSITION_Y + MP_POSITION_Y
- @mp_meter.opacity = 0 if visible?
- end
- #--------------------------------------------------------------------------
- # ▼ Actualizando barra mp
- #--------------------------------------------------------------------------
- def refresh_mp
- return if !DRAW_MP
- @mp_meter.bitmap.clear
- meter_width = @mp_meter_cw * @actor.mp / @actor.mmp rescue nil
- meter_width = 0 if meter_width == nil
- meter_src_rect = Rect.new(0, 0, meter_width, @mp_meter_ch)
- @mp_meter.bitmap.blt(0, 0, @mp_meter_image, meter_src_rect)
- @mp_meter.opacity -= 5 if visible?
- @mp_meter.opacity += 5 if !visible?
- end
- end
- #===============================================================================
- # Creando Número Mp
- #===============================================================================
- class Advanced_Hud
- def create_mp_number
- return if !DRAW_MP_NUMBER
- @mp_number = Sprite.new
- @mp_number.bitmap = Bitmap.new(@mp_number_cw * 4, @mp_number_ch)
- @mp_number.x = HUD_POSITION_X + MP_POSITION_X + 113
- @mp_number.y = HUD_POSITION_Y + MP_POSITION_Y + 5
- @mp_number.z = HUD_Z + 6
- @mp_number.zoom_y = 0.7
- @mp_number.opacity = 0 if visible?
- end
- #--------------------------------------------------------------------------
- # ▼ Actualizando número mp
- #--------------------------------------------------------------------------
- def refresh_mp_number
- return if !DRAW_MP_NUMBER
- @mp_number.bitmap.clear
- @old_number = @actor.mp
- number_value = @actor.mp.to_s.split(//)
- for r in 0..number_value.size - 1
- number_value_abs = number_value[r].to_i
- nsrc_rect = Rect.new(@mp_number_cw * number_value_abs, 0 , @mp_number_cw, @mp_number_ch)
- @mp_number.bitmap.blt(@mp_number_cw * r, 0, @mp_number_image, nsrc_rect)
- end
- @mp_number.opacity -= 5 if visible?
- @mp_number.opacity += 5 if !visible?
- @mp_number.x = HUD_POSITION_X + MP_POSITION_X + 113 - (@mp_number_cw * number_value.size)
- end
- end
- #===============================================================================
- # Creando cara del personaje
- #===============================================================================
- class Advanced_Hud
- def create_face
- return if !DRAW_FACE
- @face = Sprite.new
- @face.bitmap = Cache.advanced_hud("Actor" + @actor.id.to_s + "_Face")
- @face.z = HUD_Z + 5
- @face.x = HUD_POSITION_X + FACE_POSITION_X
- @face.y = HUD_POSITION_Y + FACE_POSITION_Y
- @face.opacity = 0 if visible?
- end
- #--------------------------------------------------------------------------
- # ▼ Actualizando cara
- #--------------------------------------------------------------------------
- def refresh_face
- return if !DRAW_FACE
- @face.bitmap = Cache.advanced_hud("Actor" + @actor.id.to_s + "_Face")
- @face.opacity -= 5 if visible?
- @face.opacity += 5 if !visible?
- end
- end
- #===============================================================================
- # Creando Layer de Level
- #===============================================================================
- class Advanced_Hud
- def create_lv_sprite
- return if !LV_SPRITE
- @lv_sprite = Sprite.new
- @lv_sprite.bitmap = Cache.advanced_hud("Level")
- @lv_sprite.z = HUD_Z + 3
- @lv_sprite.x = HUD_POSITION_X + LV_POSITION_X
- @lv_sprite.y = HUD_POSITION_Y + LV_POSITION_Y
- @lv_sprite.opacity = 0 if visible?
- end
- #--------------------------------------------------------------------------
- # ▼ Actualizando level
- #--------------------------------------------------------------------------
- def refresh_lv_sprite
- return if !LV_SPRITE
- @lv_sprite.opacity -= 5 if visible?
- @lv_sprite.opacity += 5 if !visible?
- end
- end
- #===============================================================================
- # Creando sprite Hp y MP
- #===============================================================================
- class Advanced_Hud
- def create_word
- return if !DRAW_WORD
- @word = Sprite.new
- @word.bitmap = Cache.advanced_hud("Hp_Mp")
- @word.z = HUD_Z + 6
- @word.x = HUD_POSITION_X + WORD_POSITION_X
- @word.y = HUD_POSITION_Y + WORD_POSITION_Y
- @word.opacity = 0 if visible?
- end
- #--------------------------------------------------------------------------
- # ▼ Actualizando sprite Hp y Mp
- #--------------------------------------------------------------------------
- def refresh_word
- return if !DRAW_WORD
- @word.opacity -= 5 if visible?
- @word.opacity += 5 if !visible?
- end
- end
- #===============================================================================
- # Creando número de nivel
- #===============================================================================
- class Advanced_Hud
- def create_level_number
- return if !LV_SPRITE
- @lv_number = Sprite.new
- @lv_number.bitmap = Bitmap.new(@lv_number_cw * 2, @lv_number_ch)
- @lv_number.z = HUD_Z + 4
- @lv_number.x = HUD_POSITION_X + LEVEL_NUMBER_POSITION_X
- @lv_number.y = HUD_POSITION_Y + LEVEL_NUMBER_POSITION_Y
- @lv_number.opacity = 0 if visible?
- @lv_number.zoom_x = 0.8
- @lv_number.zoom_y = 0.8
- end
- #--------------------------------------------------------------------------
- # ▼ Actualizando número de level
- #--------------------------------------------------------------------------
- def refresh_level_number
- return if !LV_SPRITE
- @lv_number.bitmap.clear
- number_value = @actor.level.abs.to_s.split(//)
- for r in 0..number_value.size - 1
- number_value_abs = number_value[r].to_i
- nsrc_rect = Rect.new(@lv_number_cw * number_value_abs, 0, @lv_number_cw, @lv_number_ch)
- @lv_number.bitmap.blt(@lv_number_cw * r, 0, @lv_number_image, nsrc_rect)
- end
- @lv_number.opacity -= 5 if visible?
- @lv_number.opacity += 5 if !visible?
- @lv_number.x = HUD_POSITION_X + LEVEL_NUMBER_POSITION_X - (number_value.size * 5)
- end
- end
- #===============================================================================
- # Creando nombre del personaje
- #===============================================================================
- class Advanced_Hud
- def create_name
- return if !DRAW_NAME
- @name = Sprite.new
- @name.bitmap = Bitmap.new(160, 32)
- @name.bitmap.font.name = NAME_FONT
- @name.bitmap.font.size = NAME_FONT_SIZE
- @name.bitmap.font.bold = NAME_FONT_BOLD
- @name.bitmap.font.italic = NAME_FONT_ITALIC
- @name.bitmap.font.color = NAME_FONT_COLOR
- @name.x = HUD_POSITION_X + NAME_POSITION_X
- @name.y = HUD_POSITION_Y + NAME_POSITION_Y
- @name.z = HUD_Z + 6
- if NAME_SHADOW
- @name.bitmap.font.color = NAME_SHADOW_FONT_COLOR
- @name.bitmap.draw_text(3, 3, 160, 32, @actor.name, 0)
- @name.bitmap.font.color = NAME_FONT_COLOR
- end
- @name.bitmap.draw_text(0, 0, 160, 32, @actor.name, 0)
- @name.opacity = 0 if visible?
- refresh_name
- end
- #--------------------------------------------------------------------------
- # ▼ Actualizando nombre
- #--------------------------------------------------------------------------
- def refresh_name
- return if !DRAW_NAME
- @name.bitmap.clear
- if NAME_SHADOW
- @name.bitmap.font.color = NAME_SHADOW_FONT_COLOR
- @name.bitmap.draw_text(3, 3, 160, 32, @actor.name, 0)
- @name.bitmap.font.color = NAME_FONT_COLOR
- end
- @name.bitmap.draw_text(0, 0, 160, 32, @actor.name, 0)
- @name.opacity -= 5 if visible?
- @name.opacity += 5 if !visible?
- end
- end
- #===============================================================================
- # Creando oro
- #===============================================================================
- class Advanced_Hud
- def create_gold
- return if !DRAW_GOLD
- @gold_layout = Sprite.new
- @gold_layout.bitmap = Cache.advanced_hud("Gold_Layout")
- @gold_layout.x = GOLD_POSITION_X
- @gold_layout.y = GOLD_POSITION_Y
- @gold_layout.z = HUD_Z + 2
- @gold_layout.opacity = 0 if visible?
- end
- def refresh_gold
- return if !DRAW_GOLD
- @gold_layout.opacity -= 5 if visible?
- @gold_layout.opacity += 5 if !visible?
- end
- def create_gold_number
- return if !DRAW_GOLD
- @gold_number = Sprite.new
- @gold_number.bitmap = Bitmap.new(@gold_number_cw * 8 , @gold_number_ch)
- @gold_number.x = GOLD_NUMBER_X
- @gold_number.y = GOLD_NUMBER_Y
- @gold_number.z = HUD_Z + 4
- @gold_number.opacity = 0 if visible?
- end
- def refresh_gold_number
- return if !DRAW_GOLD
- @gold_number.bitmap.clear
- number_value = $game_party.gold.abs.to_s.split(//)
- for r in 0..number_value.size - 1
- number_value_abs = number_value[r].to_i
- nsrc_rect = Rect.new(@gold_number_cw * number_value_abs, 0, @gold_number_cw, @gold_number_ch)
- @gold_number.bitmap.blt(@gold_number_cw * r, 0, @gold_number_image, nsrc_rect)
- end
- @gold_number.opacity -= 5 if visible?
- @gold_number.opacity += 5 if !visible?
- @gold_number.x = GOLD_NUMBER_X - (@gold_number_cw * number_value.size)
- end
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # Advanced_Hud update
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- class Advanced_Hud
- def update_hud
- refresh_hud_initial
- refresh_hp
- refresh_mp
- refresh_level_number
- refresh_face
- refresh_lv_sprite
- refresh_word
- refresh_name
- refresh_hp_number
- refresh_mp_number
- refresh_gold_number
- refresh_gold
- end
- #--------------------------------------------------------------------------
- # Actualización de todos los sprites
- #--------------------------------------------------------------------------
- def update
- update_hud
- end
- end
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # Advanced_Hud Dispose
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- class Advanced_Hud
- def dispose
- dispose_hp_meter
- dispose_mp_meter
- dispose_face
- dispose_lv_sprite
- dispose_word
- dispose_level_number
- dispose_name
- dispose_hp_number
- dispose_mp_number
- dispose_gold_layout
- dispose_gold_number
- end
- #--------------------------------------------------------------------------
- # ▼ Dispose barra de vida
- #--------------------------------------------------------------------------
- def dispose_hp_meter
- return if @hp_meter == nil
- @hp_meter.bitmap.dispose
- @hp_meter.dispose
- end
- #--------------------------------------------------------------------------
- # ▼ Dispose barra de mp
- #--------------------------------------------------------------------------
- def dispose_mp_meter
- return if @mp_meter == nil
- @mp_meter.bitmap.dispose
- @mp_meter.dispose
- end
- #--------------------------------------------------------------------------
- # ▼ Dispose cara
- #--------------------------------------------------------------------------
- def dispose_face
- return if @face == nil
- @face.bitmap.dispose
- @face.dispose
- end
- #--------------------------------------------------------------------------
- # ▼ Dispose Level layer
- #--------------------------------------------------------------------------
- def dispose_lv_sprite
- return if @lv_sprite == nil
- @lv_sprite.bitmap.dispose
- @lv_sprite.dispose
- end
- #--------------------------------------------------------------------------
- # ▼ Dispose hp mp gráfico
- #--------------------------------------------------------------------------
- def dispose_word
- return if @word == nil
- @word.bitmap.dispose
- @word.dispose
- end
- #--------------------------------------------------------------------------
- # ▼ Dispose número del nivel
- #--------------------------------------------------------------------------
- def dispose_level_number
- return if @lv_number == nil
- @lv_number.bitmap.dispose
- @lv_number.dispose
- end
- #--------------------------------------------------------------------------
- # ▼ Dispose del nombre
- #--------------------------------------------------------------------------
- def dispose_name
- return if @name == nil
- @name.bitmap.dispose
- @name.dispose
- end
- #--------------------------------------------------------------------------
- # ▼ Dispose número hp
- #--------------------------------------------------------------------------
- def dispose_hp_number
- return if @hp_number == nil
- @hp_number.bitmap.dispose
- @hp_number.dispose
- end
- #--------------------------------------------------------------------------
- # ▼ Dispose número mp
- #--------------------------------------------------------------------------
- def dispose_mp_number
- return if @mp_number == nil
- @mp_number.bitmap.dispose
- @mp_number.dispose
- end
- #--------------------------------------------------------------------------
- # ▼ Dispose del layout del oro
- #--------------------------------------------------------------------------
- def dispose_gold_layout
- return if @gold_layout == nil
- @gold_layout.bitmap.dispose
- @gold_layout.dispose
- end
- #--------------------------------------------------------------------------
- # ▼ Dispose número del oro
- #--------------------------------------------------------------------------
- def dispose_gold_number
- return if @gold_number == nil
- @gold_number.bitmap.dispose
- @gold_number.dispose
- end
- end
- end
- #===============================================================================
- #
- # ▼ Fin del mundo, acá se acaba todo ▼
- #
- #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment