AbyssalLord
Member
Hey people! I have a small problem. I'm trying to make a HUD that displays the amount of gold the player has. For some reason (I'm new with scripting so it may be obvious), the window appears on screen, but the amount of gold will not. If anyone could help me out (and maybe explain what I did wrong), I would be very grateful.
Here's the code:
Here's the code:
Code:
class Window_GoldHUD < Window_Base
def initialize
super(500,0,100,50)
self.contents = Bitmap.new(width-32, height-32)
self.opacity = 150
refresh
end
def refresh
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(500, 0, 120, 32, $game_party.gold.to_s, 2)
end
def update
super
refresh
end
end
class Scene_Map
alias goldhud_main main
alias goldhud_update update
def main
@goldhud = Window_GoldHUD.new
goldhud_main
@goldhud.dispose
end
def update
@goldhud.update
goldhud_update
end
end
Here's my new question:
I know how to make the HUD appear and disappear based on a switch, but how do I stop it from appearing for just a second whenever I return to the map screen (from the menu, starting the game, etc.)? Thanks in advance!
Here's the code:
Here's the code:
Code:
class Window_GoldHUD < Window_Base
def initialize
super(400,0,200,60)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 150
refresh
end
def refresh
self.contents.clear
self.contents.draw_text(-60, 0, 150, 32, $game_party.gold.to_s, 2)
self.contents.draw_text(100, 0, 150, 32, "Gold")
end
def update
super()
@gold != $game_party.gold
@gold = $game_party.gold
refresh
end
end
class Scene_Map
alias goldhud_main main
alias goldhud_update update
def main
@goldhud = Window_GoldHUD.new
goldhud_main
@goldhud.dispose
end
def update
@goldhud.visible = $game_switches[1]
@goldhud.update
goldhud_update
end
end
Thanks!