class Window_Estrellas < Window_Base#------------------------------=[call class]
def initialize#------------------------------------------------=[define load]
#[bottom left]
#super(-8, 410, 640, 96)#----------=[x,y window position & x,y window size]
#[top left]
super(-1, 2, 640, 96)#--------------=[x,y window position & x,y window size]
#################################################################[PICTURE SETUP]
# def draw_stars
bitmap = RPG::Cache.picture("star")#-----------------------------=[store bitmap]
src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)#----------=[bitmap box]
for i in 0...$game_party.actors[0].sp#-------------------=[display layout]
self.contents.blt(x + i * bitmap.width, y, bitmap, src_rect)#crash
end
for i in 0...$game_party.actors[0].maxsp#-------------=[show maxhp for hearts]
if i >= $game_party.actors[0].sp#-------------------=[condition for graphics]
# Draw a complete heart/star
solid_star = RPG::Cache.picture("star")
else
# Draw an empty heart/star
empty_star = RPG::Cache.picture("star container")
#################################################################[PICTURE SETUP]
#[Star Containers] (number of stars you wish to display)
#--------------------------------------------------
#estrellas = 10 #[use this setting for a fixed number of stars] or...
estrellas = $game_variables[1]#to control amount of stars by variable.
#[Opacity] (how clear or solid in appearance)
#--------------------------------------------------
opacidad = 255 #opacity: 0= invisible to 255= solid
#[Options] 0 =Blank 1 =Hero's name 2 =Value/MaxValue 3 =Stars/Maxstars 4 =HP%
#--------------------------------------------------
opcion = 0#info text, review the options above:
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]
@stars = estrellas
@opacity = opacidad
@option = opcion
@hr = 0
refresh
end
end#
end#
def refresh
@stars = $game_variables[1]#--------------------------------=[Variable_ID]
self.contents.clear
@e = $game_party.actors[0].sp
@me = $game_party.actors[0].maxsp
#n is the value, and mn the maxvalue:
@hr = 0
@lh = 0
#[containers] #coordinates = i*14,= left point
#second number 4,
#third number 4,
#fourth number 4,
for i in 0..@stars-1
#self.contents.fill_rect(i*14, 4, 1, 2, Color.new(0, 0, 0, @opacity))
self.contents.fill_rect(i*14, 4, 1, 2, Color.new(0, 0, 0, @opacity))
self.contents.fill_rect(i*14+1, 3, 1, 4, Color.new(0, 0, 0, @opacity))
self.contents.fill_rect(i*14+2, 2, 1, 6, Color.new(0, 0, 0, @opacity))
self.contents.fill_rect(i*14+3, 1, 1, 8, Color.new(0, 0, 0, @opacity))
self.contents.fill_rect(i*14+4, 0, 1, 10, Color.new(0, 0, 0, @opacity))
self.contents.fill_rect(i*14+5, 1, 1, 10, Color.new(0, 0, 0, @opacity))
self.contents.fill_rect(i*14+6, 2, 1, 10, Color.new(0, 0, 0, @opacity))
self.contents.fill_rect(i*14+7, 1, 1, 10, Color.new(0, 0, 0, @opacity))
self.contents.fill_rect(i*14+8, 0, 1, 10, Color.new(0, 0, 0, @opacity))
self.contents.fill_rect(i*14+9, 1, 1, 8, Color.new(0, 0, 0, @opacity))
self.contents.fill_rect(i*14+10, 2, 1, 6, Color.new(0, 0, 0, @opacity))
self.contents.fill_rect(i*14+11, 3, 1, 4, Color.new(0, 0, 0, @opacity))
self.contents.fill_rect(i*14+12, 4, 1, 2, Color.new(0, 0, 0, @opacity))
#[outline]
self.contents.fill_rect(i*14+1, 4, 1, 2, Color.new(255, 255, 255, @opacity))
self.contents.fill_rect(i*14+2, 3, 1, 4, Color.new(255, 255, 255, @opacity))
self.contents.fill_rect(i*14+3, 2, 1, 6, Color.new(255, 255, 255, @opacity))
self.contents.fill_rect(i*14+4, 1, 1, 8, Color.new(255, 255, 255, @opacity))
self.contents.fill_rect(i*14+5, 2, 1, 8, Color.new(255, 255, 255, @opacity))
self.contents.fill_rect(i*14+6, 3, 1, 8, Color.new(255, 255, 255, @opacity))
self.contents.fill_rect(i*14+7, 2, 1, 8, Color.new(255, 255, 255, @opacity))
self.contents.fill_rect(i*14+8, 1, 1, 8, Color.new(255, 255, 255, @opacity))
self.contents.fill_rect(i*14+9, 2, 1, 6, Color.new(255, 255, 255, @opacity))
self.contents.fill_rect(i*14+10, 3, 1, 4, Color.new(255, 255, 255, @opacity))
self.contents.fill_rect(i*14+11, 4, 1, 2, Color.new(255, 255, 255, @opacity))
#[fill in]
@c = 200#red
@l = @e*100/@me#100
@ho = @l*@stars #@c, 200, 100 = yellow
c_color(1)
self.contents.fill_rect(i*14+2, 4, 1, 2, Color.new(0, 0, @c, @opacity))
c_color(2)
self.contents.fill_rect(i*14+3, 3, 1, 4, Color.new(0, 0, @c, @opacity))
c_color(3)
self.contents.fill_rect(i*14+4, 2, 1, 6, Color.new(0, 0, @c, @opacity))
c_color(4)
self.contents.fill_rect(i*14+5, 3, 1, 6, Color.new(0, 0, @c, @opacity))
c_color(5)
self.contents.fill_rect(i*14+6, 4, 1, 6, Color.new(0, 0, @c, @opacity))
c_color(6)
self.contents.fill_rect(i*14+7, 3, 1, 6, Color.new(0, 0, @c, @opacity))
c_color(7)
self.contents.fill_rect(i*14+8, 2, 1, 6, Color.new(0, 0, @c, @opacity))
c_color(8)
self.contents.fill_rect(i*14+9, 3, 1, 4, Color.new(0, 0, @c, @opacity))
c_color(9)
self.contents.fill_rect(i*14+10, 4, 1, 2, Color.new(0, 0, @c, @opacity))
@hr += 1
end
#[update]
def update
@value=$game_variables[1]#-------------=[to update current amount of Stars]
$old_sp = $game_party.actors[0].sp#--------=[to update current amount of SP]
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, "#{@e}/#{@me}", 0)
self.contents.draw_text(0 - 1, 7 + 1, 160, 32, "#{@e}/#{@me}", 0)
self.contents.draw_text(0 + 1, 7 - 1, 160, 32, "#{@e}/#{@me}", 0)
self.contents.draw_text(0 + 1, 7 + 1, 160, 32, "#{@e}/#{@me}", 0)
self.contents.font.color = normal_color
self.contents.draw_text(0, 7, 160, 32, "#{@e}/#{@me}", 0)
elsif @option == 3
self.contents.font.color.set(0, 0, 0)
self.contents.draw_text(0 - 1, 7 - 1, 160, 32, "#{@ho/100}/#{@stars}", 0)
self.contents.draw_text(0 - 1, 7 + 1, 160, 32, "#{@ho/100}/#{@stars}", 0)
self.contents.draw_text(0 + 1, 7 - 1, 160, 32, "#{@ho/100}/#{@stars}", 0)
self.contents.draw_text(0 + 1, 7 + 1, 160, 32, "#{@ho/100}/#{@stars}", 0)
self.contents.font.color = normal_color
self.contents.draw_text(0, 7, 160, 32, "#{@ho/100}/#{@stars}", 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
#############--------------------------------------=[alias method for Scene_Map]
# Scene_Map #
#############
class Scene_Map
alias gface2_main main
def main #MAIN
@estrellas = Window_Estrellas.new
gface2_main
@estrellas.dispose
end
alias gface2_update update
def update #UPDATE
gface2_update
@estrellas.refresh if $old_sp != $game_party.actors[0].sp
@estrellas.visible = $game_switches[1]#---------------------=[Variable_ID]
@estrellas.update
end
end