Shuriken-Style
Member
Hey all, um, quick novice question to ask. I'm trying to change a script for an HP bar so that it depletes vertically rather than horizontally and I'm having some trouble (mostly because I'm just playing around with it without any real understanding of what I'm doing)
My solution was to change everything that related to 'width' and replace it with 'height' but all that achieved was a HP bar that doesn't change. Any ideas guys?
Code:
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh(actor)
hppercent = actor.hp.to_f / actor.maxhp.to_f
if hppercent > 0.66
@sprites[1].bitmap = RPG::Cache.picture($game_set.hpbar_good)
elsif hppercent > 0.33
@sprites[1].bitmap = RPG::Cache.picture($game_set.hpbar_okay)
else
@sprites[1].bitmap = RPG::Cache.picture($game_set.hpbar_bad)
end
bar_width = (@sprites[1].bitmap.width.to_f * hppercent).round
w = @sprites[1].bitmap.width-bar_width
@sprites[1].src_rect = Rect.new(0, 0, bar_width, @sprites[1].bitmap.height)
end
My solution was to change everything that related to 'width' and replace it with 'height' but all that achieved was a HP bar that doesn't change. Any ideas guys?