madmax_vii
Sponsor
im looking for a HP/SP bar that'll go in the corner of your screen while moving around, basically so it's useable with ABS please?
thanks
thanks
class Window_Base < Window
def draw_slant_bar(x, y, min, max, width = 152, height = 6,
bar_color = Color.new(150, 0, 0, 255), end_color = Color.new(255, 255, 60, 255))
for i in 0..height
self.contents.fill_rect(x + i, y + height - i, width + 1, 1, Color.new(50, 50, 50, 255))
end
for i in 1..(height - 1)
r = 100 * (height - i) / height + 0 * i / height
g = 100 * (height - i) / height + 0 * i / height
b = 100 * (height - i) / height + 0 * i / height
a = 255 * (height - i) / height + 255 * i / height
self.contents.fill_rect(x + i, y + height - i, width, 1, Color.new(r, b, g, a))
end
for i in 1..( (min / max.to_f) * width - 1)
for j in 1..(height - 1)
r = bar_color.red * (width - i) / width + end_color.red * i / width
g = bar_color.green * (width - i) / width + end_color.green * i / width
b = bar_color.blue * (width - i) / width + end_color.blue * i / width
a = bar_color.alpha * (width - i) / width + end_color.alpha * i / width
self.contents.fill_rect(x + i + j, y + height - j, 1, 1, Color.new(r, g, b, a))
end
end
end
end
class HPMP_Bars < Window_Base
def initialize
super(0,0,300,100)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 0
@old_hp = $game_party.actors[0].hp
@old_sp = $game_party.actors[0].sp
refresh
end
def refresh
self.contents.clear
@actor = $game_party.actors[0]
self.contents.draw_text(4,0,100,32, $data_system.words.hp + ":")
self.contents.draw_text(4,32,100,32, $data_system.words.sp + ":")
draw_slant_bar(45, 15, @actor.hp, @actor.maxhp, 90, 6)
draw_slant_bar(45, 47, @actor.sp, @actor.maxsp, 90, 6, Color.new(0, 0, 150, 255), Color.new(60, 255, 255, 255))
end
def update
super
if @old_hp != @actor.hp or @old_sp != @actor.sp
refresh
@old_hp = @actor.hp
@old_sp = @actor.sp
end
end
end
class Scene_Map
alias raz_map_main main
alias raz_map_update update
def main
@bars = HPMP_Bars.new
raz_map_main
@bars.dispose
end
def update
@bars.update
raz_map_update
end
end