Hey just thought id ask here if anyone can help me tidy up my first script, im pretty sure theres a way easier way of doing it. Some of it is code from the playtime window and I was wondering if there was a way to call the information from that script, instead of duplicating it in mine. Thanks in advance :]
Code:
class Window_PLayTimeHud < Window_Base
def initialize
super(0, 0, 210, 64)
self.contents = Bitmap.new(width-32, height-32)
self.opacity = 200
self.contents.clear
refresh
end
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(0, 0, 120, 32, "Play Time:")
@total_sec = Graphics.frame_count / Graphics.frame_rate
hour = @total_sec / 60 / 60
min = @total_sec / 60 % 60
sec = @total_sec % 60
text = sprintf("%02d:%02d:%02d", hour, min, sec)
self.contents.font.color = normal_color
self.contents.draw_text(50, 0, 120, 32, text, 2)
end
def update
super
if Graphics.frame_count / Graphics.frame_rate != @total_sec
refresh
end
end
end
class Scene_Map
alias playtimehud_main main
alias playtimehud_update update
def main
@playtimehud = Window_PLayTimeHud.new
playtimehud_main
@playtimehud.dispose
end
def update
@playtimehud.update
playtimehud_update
end
end