class Window_Help < Window_Base
attr_accessor :scan # Accessor attribute to check if scanning is on or off
def initialize
super(0, 0, 640, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font = Font.new("Arial")
@SCAn = false # Initially, scanning is off
end
def set_text(text, align = 0)
if text != @text or align != @align
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, self.width - 40, 32, text, align)
@text = text
@align = align
@actor = nil
end
self.visible = true
end
def set_actor(actor)
if actor != @actor
self.contents.clear
draw_actor_name(actor, 4, 0)
draw_actor_state(actor, 140, 0)
draw_actor_hp(actor, 284, 0)
draw_actor_sp(actor, 460, 0)
@actor = actor
@text = nil
self.visible = true
end
end
# Method to set enemy information in the help window
def set_enemy(enemy)
hp_text = "HP:"
mp_text = "MP:"
hp_data = "#{enemy.hp}/#{enemy.maxhp}"
mp_data = "#{enemy.sp}/#{enemy.maxsp}"
# Drawing text on screen
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, 160, 32, "#{enemy.name}", 1) # Enemy name
self.contents.font.color = Color.new(0, 191, 255) # Light blue color for HP
self.contents.draw_text(160, 0, 32, 32, hp_text) # HP text
self.contents.font.color = normal_color
self.contents.draw_text(192, 0, 100, 32, hp_data) # HP data
self.contents.font.color = Color.new(0, 191, 255) # Light blue color for MP
self.contents.draw_text(292, 0, 32, 32, mp_text) # MP text
self.contents.font.color = normal_color
self.contents.draw_text(324, 0, 100, 32, mp_data) # MP data
self.visible = true
end
end