class Window_Corazones < Window_Base
def initialize
super(-8, 410, 640, 96)############################[window position & size]
#[SETTINGS]
#corazones = 10 #use this setting for a fixed number of hearts. or...
corazones = @value=$game_variables[2]#to control amount of hearts by variable.
opacidad = 255 #opacity: 0= invisible to 255= solid
opcion = 1 #info text, review the options below:
#[OPTIONS]
# Corazones = (number of hearts you wish to display)
# Opacidad = (how clear or soild in appearance)
# Options = (settings for information text)
# 0=Blank 1=Hero name 2=Value/MaxValue 3=Hearts/Maxhearts 4=HP%
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Impact"#---------------------------=[FONT TYPE]
self.contents.font.size = 24#---------------------------------=[FONT SIZE]
self.z = 3000#-------------------------------------------------=[BLENDING]
self.opacity = 0 #------------------------------------------=[WINDOW SKIN]
@hearts = corazones
@opacity = opacidad
@option = opcion
@hr = 0
refresh
end
def refresh
@hearts = $game_variables[2]
self.contents.clear
@corazones = $game_variables[2]##################################[insert]
@n = $game_party.actors[0].hp
@mn = $game_party.actors[0].maxhp
#n is the value, and mn the maxvalue:
@hr = 0
@lh = 0
###############################################################[black for empty]
for i in 0..@hearts-1
self.contents.fill_rect(i*24, 4, 1, 2, Color.new(0, 0, 0, @opacity))
self.contents.fill_rect(i*24+1, 3, 1, 4, Color.new(0, 0, 0, @opacity))
self.contents.fill_rect(i*24+2, 2, 1, 6, Color.new(0, 0, 0, @opacity))
self.contents.fill_rect(i*24+3, 1, 1, 8, Color.new(0, 0, 0, @opacity))
self.contents.fill_rect(i*24+4, 0, 1, 10, Color.new(0, 0, 0, @opacity))
self.contents.fill_rect(i*24+5, 1, 1, 10, Color.new(0, 0, 0, @opacity))
self.contents.fill_rect(i*24+6, 2, 1, 10, Color.new(0, 0, 0, @opacity))
self.contents.fill_rect(i*24+7, 1, 1, 10, Color.new(0, 0, 0, @opacity))
self.contents.fill_rect(i*24+8, 0, 1, 10, Color.new(0, 0, 0, @opacity))
self.contents.fill_rect(i*24+9, 1, 1, 8, Color.new(0, 0, 0, @opacity))
self.contents.fill_rect(i*24+10, 2, 1, 6, Color.new(0, 0, 0, @opacity))
self.contents.fill_rect(i*24+11, 3, 1, 4, Color.new(0, 0, 0, @opacity))
self.contents.fill_rect(i*24+12, 4, 1, 2, Color.new(0, 0, 0, @opacity))
#############################################################[white for outline]
self.contents.fill_rect(i*24+1, 4, 1, 2, Color.new(255, 255, 255, @opacity))
self.contents.fill_rect(i*24+2, 3, 1, 4, Color.new(255, 255, 255, @opacity))
self.contents.fill_rect(i*24+3, 2, 1, 6, Color.new(255, 255, 255, @opacity))
self.contents.fill_rect(i*24+4, 1, 1, 8, Color.new(255, 255, 255, @opacity))
self.contents.fill_rect(i*24+5, 2, 1, 8, Color.new(255, 255, 255, @opacity))
self.contents.fill_rect(i*24+6, 3, 1, 8, Color.new(255, 255, 255, @opacity))
self.contents.fill_rect(i*24+7, 2, 1, 8, Color.new(255, 255, 255, @opacity))
self.contents.fill_rect(i*24+8, 1, 1, 8, Color.new(255, 255, 255, @opacity))
self.contents.fill_rect(i*24+9, 2, 1, 6, Color.new(255, 255, 255, @opacity))
self.contents.fill_rect(i*24+10, 3, 1, 4, Color.new(255, 255, 255, @opacity))
self.contents.fill_rect(i*24+11, 4, 1, 2, Color.new(255, 255, 255, @opacity))
#######################################################################[fill in]
@c = 255
@l = @n*100/@mn
@ho = @l*@hearts
c_color(1)
self.contents.fill_rect(i*24+2, 4, 1, 2, Color.new(@c, 0, 0, @opacity))
c_color(2)
self.contents.fill_rect(i*24+3, 3, 1, 4, Color.new(@c, 0, 0, @opacity))
c_color(3)
self.contents.fill_rect(i*24+4, 2, 1, 6, Color.new(@c, 0, 0, @opacity))
c_color(4)
self.contents.fill_rect(i*24+5, 3, 1, 6, Color.new(@c, 0, 0, @opacity))
c_color(5)
self.contents.fill_rect(i*24+6, 4, 1, 6, Color.new(@c, 0, 0, @opacity))
c_color(6)
self.contents.fill_rect(i*24+7, 3, 1, 6, Color.new(@c, 0, 0, @opacity))
c_color(7)
self.contents.fill_rect(i*24+8, 2, 1, 6, Color.new(@c, 0, 0, @opacity))
c_color(8)
self.contents.fill_rect(i*24+9, 3, 1, 4, Color.new(@c, 0, 0, @opacity))
c_color(9)
self.contents.fill_rect(i*24+10, 4, 1, 2, Color.new(@c, 0, 0, @opacity))
@hr += 1
end
##############################################[need update]
def update
#super
@corazones.visible = $game_switches[2]##################################[insert]
refresh
end
#######################################################################[options]
if @option == 1
self.contents.font.color.set(0, 0, 0)
self.contents.draw_text(0 - 1, 7 - 1, 160, 32, $game_party.actors[0].name, 0)
self.contents.draw_text(0 - 1, 7 + 1, 160, 32, $game_party.actors[0].name, 0)
self.contents.draw_text(0 + 1, 7 - 1, 160, 32, $game_party.actors[0].name, 0)
self.contents.draw_text(0 + 1, 7 + 1, 160, 32, $game_party.actors[0].name, 0)
self.contents.font.color = normal_color
self.contents.draw_text(0, 7, 160, 32, $game_party.actors[0].name, 0)
elsif @option == 2
self.contents.font.color.set(0, 0, 0)
self.contents.draw_text(0 - 1, 7 - 1, 160, 32, "#{@n}/#{@mn}", 0)
self.contents.draw_text(0 - 1, 7 + 1, 160, 32, "#{@n}/#{@mn}", 0)
self.contents.draw_text(0 + 1, 7 - 1, 160, 32, "#{@n}/#{@mn}", 0)
self.contents.draw_text(0 + 1, 7 + 1, 160, 32, "#{@n}/#{@mn}", 0)
self.contents.font.color = normal_color
self.contents.draw_text(0, 7, 160, 32, "#{@n}/#{@mn}", 0)
elsif @option == 3
self.contents.font.color.set(0, 0, 0)
self.contents.draw_text(0 - 1, 7 - 1, 160, 32, "#{@ho/100}/#{@hearts}", 0)
self.contents.draw_text(0 - 1, 7 + 1, 160, 32, "#{@ho/100}/#{@hearts}", 0)
self.contents.draw_text(0 + 1, 7 - 1, 160, 32, "#{@ho/100}/#{@hearts}", 0)
self.contents.draw_text(0 + 1, 7 + 1, 160, 32, "#{@ho/100}/#{@hearts}", 0)
self.contents.font.color = normal_color
self.contents.draw_text(0, 7, 160, 32, "#{@ho/100}/#{@hearts}", 0)
elsif @option == 4
self.contents.font.color.set(0, 0, 0)
self.contents.draw_text(0 - 1, 7 - 1, 160, 32, "#{@l}%", 0)
self.contents.draw_text(0 - 1, 7 + 1, 160, 32, "#{@l}%", 0)
self.contents.draw_text(0 + 1, 7 - 1, 160, 32, "#{@l}%", 0)
self.contents.draw_text(0 + 1, 7 + 1, 160, 32, "#{@l}%", 0)
self.contents.font.color = normal_color
self.contents.draw_text(0, 7, 160, 32, "#{@l}%", 0)
end
end
end
##################################################################[color method]
def c_color(a)
if @hr <= (@ho/100)-1
@c = 255 #
else
if @ho/10-@hr*10 >= a and @ho/10-@hr*10 <= 9
@c = 255 #
else
@c = 0 #
end
end
end
################################################################################
########################################################################[insert]
# Scene_Map #
#############
class Scene_Map
alias gface1_main main
def main #MAIN
@Corazones = Window_Corazones.new#######################################[insert]
gface1_main
@Corazones.dispose######################################################[insert]
end
alias gface1_update update
def update #UPDATE
gface1_update
old_hp = $game_party.actors[0].hp#######################################[insert]
$corazones.refresh if old_hp != $game_party.actors[0].hp##########[insert]
end
end