Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

# of arguments?? (scripting)

Crase

Member

Edit: Nevermind, I fixed it up.... I know I may have more stuff than neccessary, but it works (somewhat)

Script
Code:
class HUD< Window_Base
  def draw_hp(x, y, min, max, width, height,bar_color = Color.new(150, 0, 0, 255) )
    self.contents.fill_rect(x, y, width, height, Color.new(50, 50, 50, 255))
    self.contents.fill_rect(x + 1, y + 1, (width - 2) * (min / max.to_f), height - 2, bar_color)
  end
  def draw_sp(x, y, min, max, width, height,bar_color = Color.new(0, 0, 150, 255) )
    self.contents.fill_rect(x, y, width, height, Color.new(50, 50, 50, 255))
    self.contents.fill_rect(x + 1, y + 1, (width - 2) * (min / max.to_f), height - 2, bar_color)
  end
end

class Draw_hud < HUD
  def initialize
  super(0, 0, (640/4), (480/4))
  self.contents = Bitmap.new(width-32,height-32)
  self.opacity = 55
  hp=$game_party.actors[0].hp
  maxhp=$game_party.actors[0].hp
  sp=$game_party.actors[0].sp
  maxsp=$game_party.actors[0].maxsp
  hp_s=hp.to_s
  maxhp_s=maxhp.to_s
  sp_s=sp.to_s
  maxsp_s=maxsp.to_s
  draw_hp(0, 0, hp, maxhp, width - 32, 10)
  draw_sp(0, 10, sp, maxsp, width - 32, 10)
  self.contents.font.name = "Verdana"
  self.contents.font.size = 12
  self.contents.draw_text(0, 0, 120, 32, ""+hp_s+"/"+maxhp_s)
  self.contents.draw_text(0, 10, 120, 32, ""+sp_s+"/"+maxsp_s)
end
end

Screen
http://img204.imageshack.us/img204/2687/46991296ji9.png[/img]

But how do I get the window to be transparent??? Even though I set the opacity to 55, it still goes to full opacity (255)
 
From what I can see in your script, you set the window's bitmap opacity to 55, but your draw_hp and draw_sp methods fill the rectangles with an opacity of 255, hope that solves the problem
 

Crase

Member

Yea, I want the hp and sp bars to have full opacity, but I want the window to be kind of transparent.  But even if I set the opacity of the bars to a lower number, it still doesnt solve anything
 
hmmm...this is strange, when I use your script and call it by using "Draw_hud.new" it draws a pretty transparant HUD.
Where do you use Draw_hud, because if you use it in an update method, the problem COULD be that you keep redrawing it. When I use the event calling that script over and over and over, the HUD gets less transparant because there's loads of them. You sure that's not the problem?
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top