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.

need help with my hud

Status
Not open for further replies.
well i'm working on my hud for my game and the script is working but it doesn't show the image of the hud!?!?!heres the script for my hud
Code:
class Scene_Map

  alias hud_main main
  alias hud_update update
  
  def main
    @status = Window_Hud.new
    @hud = Sprite.new
    @hud.bitmap = RPG::Cache.picture("Hud")
    hud_main
  end
  
  def update
    @status.update
    @hud.update
    if $game_switches[3] == true
      @status.visible = true
      @hud.visible = true
    else
      @status.visible = false
      @hud.visible = false
    end
    hud_update
  end
end
can someone fix it so it shows because to me nothing looks wrong
 
#==============================================================================
# â–  Window_Hud
#------------------------------------------------------------------------------
#  バトル画面でパーティメンバーのステータスを表示するウィンドウです。
#==============================================================================

class Window_Hud < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(0, 365, 400, 115)
self.contents = Bitmap.new(width, height)
self.windowskin = nil
refresh
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
self.contents.clear
actor = $game_party.actors[0]
draw_actor_name(actor, 2, 0)
draw_actor_hp(actor, 110, 20)
end
end

theres nothing special to it because i can't add the right x's and y's since i don't know where they go and can't tell since the pic doesn't show
 
You have to use this:
Code:
class Scene_Map

  alias hud_update update
  
  def main
    # Make sprite set
    @spriteset = Spriteset_Map.new
    # Make message window
    @message_window = Window_Message.new
    @status = Window_Hud.new
    @hud = Sprite.new
    @hud.bitmap = RPG::Cache.picture("HUD")
    # Transition run
    Graphics.transition
    # Main loop
    loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      # Frame update
      update
      # Abort loop if screen is changed
      if $scene != self
        break
      end
    end
    # Prepare for transition
    Graphics.freeze
    # Dispose of sprite set
    @spriteset.dispose
    # Dispose of message window
    @message_window.dispose
    # If switching to title screen
    if $scene.is_a?(Scene_Title)
      # Fade out screen
      Graphics.transition
      Graphics.freeze
    end
  end
  
  def update
    @status.update
    @hud.update
    if $game_switches[3] == true
      @status.visible = true
      @hud.visible = true
    else
      @status.visible = false
      @hud.visible = false
    end
    hud_update
  end
end

By aliasing the main method, Spriteset_Map is called after you called the Hud causing your picture not to show.
 
Status
Not open for further replies.

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