I have made an error somewhere in this script, but I'm not sure where.
It is probably horribly coded. I've honestly never used the "for i in 1...blah" syntax before.
I wondered if anyone could help me?
Basically, the window shows but no content inside (in other words, the bars for the Hud don't show).
What it should show, if all is right, is this:
Mock-up only
http://img.photobucket.com/albums/v108/ ... test_0.png[/IMG]
What it currently shows is this:
http://img.photobucket.com/albums/v108/ ... test_1.png[/IMG]
The graphics:
http://img.photobucket.com/albums/v108/ ... rty_hp.png[/IMG]
http://img.photobucket.com/albums/v108/ ... hpback.png[/IMG]
Notes:
I know, it looks awful at the moment. That's because this is just the coding stages.
Sorry for the poor coding and lack of commenting, it's not for public release and I tend to just make mental notes, except for really important bits...
Notes again:
If you really care, this is what I'm aiming for:
Edit:
While this topic is here.. anyone know how I can change this to make a verticle bar, starting from the bottom going up?
i.e.
_
_
_
_
_
_
_
It is probably horribly coded. I've honestly never used the "for i in 1...blah" syntax before.
I wondered if anyone could help me?
Basically, the window shows but no content inside (in other words, the bars for the Hud don't show).
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
class Game_Hud < Window_Base
def initialize
super(363-16, 232-16, 103+32, 75+32)
self.contents = Bitmap.new(width - 32, height - 32)
self.z = 9999
#self.opacity = 0
#self.visible = $game_switches[x]
self.windowskin = RPG::Cache.windowskin('001-blue01')
draw_group_bars
#draw_player_bars
refresh
end
def draw_group_bars
for i in 1...$game_party.actors.size
x = 36
y = 8 + i * 15
p = $game_party.actors[i]
name = p.name
self.contents.draw_2pic_gradient_bar(x, y, p.hp, p.hpmax, 'party_hpback', 'party_hp')
self.contents.font.colour = black
self.contents.font.size = 12
self.contents.draw_text(38, 10 + y, width, height, '#{name}')
end
end
#def draw_player_bars
#end
def refresh_a
for i in 1...$game_party.actors.size
@hp_current = $game_party.actors[i].hp
refresh_bars if @hp_current != @old_hp
end
end
def refresh
for i in 1...$game_party.actors.size
@old_hp = $game_party.actors[i].hp
refresh_a
end
end
end
class Scene_Map
alias game_hud_main initialize
alias game_hud_refresh update
def initialize
@hud_win = Game_Hud.new
game_hud_main
end
def update
@hud_win.refresh
game_hud_refresh
end
end
What it should show, if all is right, is this:
Mock-up only
http://img.photobucket.com/albums/v108/ ... test_0.png[/IMG]
What it currently shows is this:
http://img.photobucket.com/albums/v108/ ... test_1.png[/IMG]
The graphics:
http://img.photobucket.com/albums/v108/ ... rty_hp.png[/IMG]
http://img.photobucket.com/albums/v108/ ... hpback.png[/IMG]
Notes:
I know, it looks awful at the moment. That's because this is just the coding stages.
Sorry for the poor coding and lack of commenting, it's not for public release and I tend to just make mental notes, except for really important bits...
Notes again:
If you really care, this is what I'm aiming for:
http://img.photobucket.com/albums/v108/dudemaster/swamp2.png[/IMG]
Edit:
While this topic is here.. anyone know how I can change this to make a verticle bar, starting from the bottom going up?
i.e.
_
_
_
_
_
_
_
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