08-11-2013, 05:38 PM
As he said, change the windowskin graphic you are using for your HP_BAR vertical... a simple rotate 90* in any paint program should work.... BUT... an edit to the HP script was needed.
I just edited the original code you provided from Atoa's script, inverted 'both' the width/height and the x/y positions in the destination rectangle system, and added a bunch of comments to describe.
Still... he didn't need to make the values anything but instant values (the '@' weren't necessary if they were for use in just that method). The mem resources are saved just a little and are cleared once they leave the method.
This is untested as I just cobbled this bit together while at work. I have no RMXP editor in front of me.
Code:
#--------------------------------------------------------------------------
# * Draw HP
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# width : draw spot width
#--------------------------------------------------------------------------
alias draw_actor_hp_bar draw_actor_hp
def draw_actor_hp(actor, x, y, width = 144)
# Set Bar Position
bar_x = HP_Pos_Adjust[0] + x
bar_y = HP_Pos_Adjust[1] + y + (Font.default_size * 2 /3)
# Acquire bar image and dimensions
bar_img = RPG::Cache.windowskin(HP_Meter)
bar_width = bar_img.width
bar_height = bar_img.height / 3
# Define source rectangle for bar
src_rect = Rect.new(0, 0, bar_width, bar_height)
self.contents.blt(bar_x, bar_y, bar_img, src_rect)
# Determine which line used in bar image
bar_line = (actor.hp == actor.maxhp ? 2 : 1)
# Calculate value to adjust drawn line
bar_amount = actor.hp.to_f / actor.maxhp.to_f
# Adjust dimensions of destination rectangle
src_rect2 = Rect.new(bar_line * bar_width, 0, bar_width, bar_height * bar_amount)
# Draw the bar with the new rectangle area
self.contents.blt(bar_x, bar_y, bar_img, src_rect2)
# Perform the original call
draw_actor_hp_bar(actor, x, y, width)
end
I just edited the original code you provided from Atoa's script, inverted 'both' the width/height and the x/y positions in the destination rectangle system, and added a bunch of comments to describe.
Still... he didn't need to make the values anything but instant values (the '@' weren't necessary if they were for use in just that method). The mem resources are saved just a little and are cleared once they leave the method.
This is untested as I just cobbled this bit together while at work. I have no RMXP editor in front of me.