Hey everybody, below follows a method of "Icon Bars." It works perfectly under RMVX and I would like to know how do I get the "HP" and "MP" the character is represented by icons (using this method to draw the bars).
Displaying Icon Bars on a window common
http://i433.photobucket.com/albums/qq55 ... bars_1.png[/img]
Example of how to be on HP and/or MP's character:
http://i433.photobucket.com/albums/qq55 ... bars_2.png[/img]
Code of Icon Bar:
Thank you for any help. :thumb:
Displaying Icon Bars on a window common
http://i433.photobucket.com/albums/qq55 ... bars_1.png[/img]
Example of how to be on HP and/or MP's character:
http://i433.photobucket.com/albums/qq55 ... bars_2.png[/img]
Code of Icon Bar:
Code:
class Window_Base < Window
#--------------------------------------------------------------------------
# * Draw icon bar
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# value : number of half-icons to draw filled
# max : number of half-icons to draw total
# filled : name of icon used as filled
# empty : name of icon used as empty
#-----------------------------------------------------------------------
def draw_icon_bar(x, y, value, max, filled = 'Filled', empty = 'Empty')
return if self.contents == nil
filled_icon = Cache.picture(filled)
empty_icon = Cache.picture(empty)
for i in 0...value
icon_x = (i / 2) * 32 + ((i % 2) * 12) + x
if i % 2 == 1
rectangle = Rect.new(12, 0, 12, 24)
else
rectangle = Rect.new(0, 0, 12, 24)
end
self.contents.blt(icon_x, y + 4, filled_icon, rectangle, 255)
end
for i in value...max
icon_x = (i / 2) * 32 + ((i % 2) * 12) + x
if i % 2 == 1
rectangle = Rect.new(12, 0, 12, 24)
else
rectangle = Rect.new(0, 0, 12, 24)
end
self.contents.blt(icon_x, y + 4, empty_icon, rectangle, 255)
end
end
end
Thank you for any help. :thumb: