Hi, I am using this bar script:
(I believe either Trickster or Seph made this, please correct me if I'm wrong. I dunno as I forgot and the forum backup meant the post has been lost ':| ).
...to draw a bar for "limit break" and "exp" for a menu system I am making.
The only trouble is, it cuts off the bar part way. I am not supposed to define a width, and there is nowhere to do so, so I have not. The width is determined by the width of the image:
ff_a_back: http://img.photobucket.com/albums/v108/ ... a_back.png[/IMG]
ff_a_exp: http://img.photobucket.com/albums/v108/ ... _a_exp.png[/IMG]
ff_a_limit: http://img.photobucket.com/albums/v108/ ... _limit.png[/IMG]
The bar should fill the space in the background image if drawn properly.
This is my code:
...and here's a screenshot of what I mean:
http://img.photobucket.com/albums/v108/ ... _error.png[/IMG]
Also, while taking the screenshot I noticed another problem: it does not draw a bar for the second or third actor in the party.
Code:
class Bitmap
def draw_2pic_gradient_bar(x, y, current, max, background_file, bar_file)
bitmap = RPG::Cache.picture(background_file)
self.blt(x, y, bitmap, Rect.new(0, 0, bitmap.width, bitmap.height))
bitmap = RPG::Cache.picture(bar_file)
w = Integer(bitmap.width * (current / max.to_f))
self.blt(x, y, bitmap, Rect.new(0, 0, w, bitmap.height))
end
end
(I believe either Trickster or Seph made this, please correct me if I'm wrong. I dunno as I forgot and the forum backup meant the post has been lost ':| ).
...to draw a bar for "limit break" and "exp" for a menu system I am making.
The only trouble is, it cuts off the bar part way. I am not supposed to define a width, and there is nowhere to do so, so I have not. The width is determined by the width of the image:
ff_a_back: http://img.photobucket.com/albums/v108/ ... a_back.png[/IMG]
ff_a_exp: http://img.photobucket.com/albums/v108/ ... _a_exp.png[/IMG]
ff_a_limit: http://img.photobucket.com/albums/v108/ ... _limit.png[/IMG]
The bar should fill the space in the background image if drawn properly.
This is my code:
Code:
#==============================================================================
# ** Window_MenuStatus
#------------------------------------------------------------------------------
# This window displays party member status on the menu screen.
#==============================================================================
class Window_MenuStatus_a < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(19-16, 0, 156, 200)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
x = 0
y = i * 50
actor = $game_party.actors[i]
self.contents.font.size = 12
self.contents.draw_text(x, y+1, 200, 12, actor.name)
self.contents.font.size = 12
draw_actor_level(actor, x+16, y + 14)
@minhp = actor.hp
@maxhp = actor.maxhp
@minsp = actor.sp
@maxsp = actor.maxsp
self.contents.draw_text(x+15, y+23, 200, 10, "#{@minhp}/#{@maxhp}")
self.contents.draw_text(x+15, y+33, 200, 10, "#{@minsp}/#{@maxsp}")
@minxp = actor.now_exp
@maxxp = actor.next_exp
#temporary - limit break not added yet
self.contents.draw_2pic_gradient_bar(x+102, x+16, 0, 1, "ff_a_back", "ff_a_limit")
self.contents.draw_2pic_gradient_bar(x+102, x+35, @minxp, @maxxp, "ff_a_back", "ff_a_exp")
end
end
#--------------------------------------------------------------------------
# * Cursor Rectangle Update
#--------------------------------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(0, @index * 50, self.width - 32, 96)
end
end
end
Code:
@minxp = actor.now_exp
@maxxp = actor.next_exp
#temporary - limit break not added yet
self.contents.draw_2pic_gradient_bar(x+102, x+16, 0, 1, "ff_a_back", "ff_a_limit")
self.contents.draw_2pic_gradient_bar(x+102, x+35, @minxp, @maxxp, "ff_a_back", "ff_a_exp")
...and here's a screenshot of what I mean:
http://img.photobucket.com/albums/v108/ ... _error.png[/IMG]
Also, while taking the screenshot I noticed another problem: it does not draw a bar for the second or third actor in the party.