I have a window,
I have this on the map in my Hud. I want to make it refresh if the HP or SP of the player changes. Otherwise, the bars will be wrong unless the menu is opened/closed, or unless I change maps.
Is there something I must add to Scene_Map, or to this script, or anything?
Code:
class Window_HudBars < Window_Base
#----------------------------------------
# Object Initialization
#----------------------------------------
def initialize
super(178, 360, 360, 60)
self.contents = Bitmap.new(width - 32, height - 32)
self.z = 200
self.opacity = 0
refresh
end
def refresh
self.contents.clear
self.contents.font.color = normal_color
self.contents.font.size = 16
@minhp = $game_party.actors[0].hp
@maxhp = $game_party.actors[0].maxhp
@minsp = $game_party.actors[0].sp
@maxsp = $game_party.actors[0].maxsp
draw_slant_bar(0, 0, @minhp, @maxhp, width = 144, height = 14, bar_color = Color.new(128, 0, 0, 255), end_color = Color.new(173, 14, 5, 255))
draw_slant_bar(144, 0, @minsp, @maxsp, width = 144, height = 14, bar_color = Color.new(0, 0, 128, 255), end_color = Color.new(5, 49, 165, 255))
end
end
I have this on the map in my Hud. I want to make it refresh if the HP or SP of the player changes. Otherwise, the bars will be wrong unless the menu is opened/closed, or unless I change maps.
Is there something I must add to Scene_Map, or to this script, or anything?