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.

HUD Picture Display

Hi, I'm making a non-SDK HUD for my game. I'd like to include the facesets for my characters within it, but I do not recall how to display a picture in the window.

Below is the script I currently have implanted. I have manually implanted the call and such in Scene_Map.
Code:
class Window_HUD < Window_Base
  
  def initialize
    super(0, 0, 640, 100)
    self.contents = Bitmap.new(width-32, height-32)
    self.opacity = 0
  end
  
  def update
    if $game_switches[1] == true then
      self.contents.clear
      self.opacity = 125
      self.contents.font.name = "Arial"  
      self.contents.font.size = 24
      self.contents.draw_text(0, -5, 620, 50, $game_party.actors[0].name)
      self.contents.draw_text(100, -5, 580, 50, "HP: " + $game_party.actors[0].hp.to_s)
      self.contents.draw_text(200, -5, 540, 50, "SP: " + $game_party.actors[0].sp.to_s)
      self.contents.draw_text(300, -5, 500, 50, "Level " + $game_party.actors[0].level.to_s)
      self.contents.draw_text(0, 35, 620, 50, $game_party.actors[1].name)
      self.contents.draw_text(100, 35, 580, 50, "HP: " + $game_party.actors[1].hp.to_s)
      self.contents.draw_text(200, 35, 540, 50, "SP: " + $game_party.actors[1].sp.to_s)
      self.contents.draw_text(300, 35, 500, 50, "Level " + $game_party.actors[1].level.to_s)
      self.contents.draw_text(400, -5, 460, 50, $game_party.gold.to_s + " Gold")
     end
  end
end

Thank you for your assistance.

Edit: Also, I'm adding "self.contents.font.color" to show one character's stats from another for a new organization. I am unsure of what to do for the color in terms of context. I tried HEX color, "red", and numbers because I thought that may have worked for whatever reason. What do I do for the color?

Thank you again.
 
after "self.contents.clear" insert
Code:
bitmap = RPG::Cache.picture("Name of Picture")
self.contents.blt(x, y, bitmap, Rect.new(0, 0, bitmap.width, bitmap.height))

Just change the x and y position for the picture.

as for the color use:
Code:
self.contents.font.color = Color.new([I]red[/I], [I]green[/I], [I]blue[/I])
 

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