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.

My HUD problem

I'm making a custom HUD using Mr.Mo's Window/Scene wizard again, and I need to know how to make it show up and run ontop of the map.
Here's the scene code:
Code:
#==============================================================================
# Scene_Hud
#==============================================================================
class Scene_Hud
  #--------------------------------------------------------------------------
  # * Main - Handles drawing/disposing windows and the main loop 
  #--------------------------------------------------------------------------
  def main
    #Draw Windows
    main_draw
    #Execute transition
    Graphics.transition
    #Main Loop
    loop do
      #Main Loop
      main_loop
      break if main_scenechange?
    end
    #Prepare for transition
    Graphics.freeze
    #Dispose Windows
    main_dispose
  end
  #--------------------------------------------------------------------------
  # * Main Draw - Handles drawing windows
  #--------------------------------------------------------------------------
  def main_draw
    #Draw Background
    @background = Spriteset_Map.new
    #Draw Windows
    # Portrait
    @Portrait = Portrait.new
    # Stat
    @Stat = Stat.new
  end
  #--------------------------------------------------------------------------
  # * Main Scene Change 
  #--------------------------------------------------------------------------
  def main_scenechange?
    # Abort loop if screen is changed
    if $scene != self
      return true
    end
    return false
  end
  #--------------------------------------------------------------------------
  # * Main Dispose 
  #--------------------------------------------------------------------------
  def main_dispose
    #Dispose Background
    @background.dispose
    # Dispose All Windows
    # Dispose Portrait
    @Portrait.dispose
    # Dispose Stat
    @Stat.dispose
  end
  #--------------------------------------------------------------------------
  # * Main Loop 
  #--------------------------------------------------------------------------
  def main_loop
    # Update game screen
    Graphics.update
    # Update input information
    Input.update
    # Frame update
    update
  end
  #--------------------------------------------------------------------------
  # * Update 
  #--------------------------------------------------------------------------
  def update
    # Update Windows
    update_windows
  end
  #--------------------------------------------------------------------------
  # * Window Update 
  #--------------------------------------------------------------------------
  def update_windows
    # Update Portrait
    @Portrait.update if @Portrait.visible
    # Update Stat
    @Stat.update if @Stat.visible
  end
end
Thanks
 
You will have to just use the windows... like this.

In Scene_Map main add this after the @spriteset = Spriteset_Map.new
Main_Draw
after @spriteset.dispose add
main_dispose
after update add
update_windows

^^Make sure you copied all those methods(used) to scene_map.
 
Code:
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
#  This class performs map screen processing.
#==============================================================================
class Scene_Map 
  alias cg1_main main
  def main
    main_draw
    cg1_main
    main_dispose
  end
  alias cg1_update update
  def update
    update_windows
    cg1_update
  end
  #--------------------------------------------------------------------------
  # * Main Draw - Handles drawing windows
  #--------------------------------------------------------------------------
  def main_draw
    #Draw Background
    @background = Spriteset_Map.new
    #Draw Windows
    # Portrait
    @Portrait = Portrait.new
    # Stat
    @Stat = Stat.new
  end
  #--------------------------------------------------------------------------
  # * Main Dispose- Handles disposing windows
  #--------------------------------------------------------------------------
  def main_dispose
    #Dispose Background
    @background.dispose
    # Dispose All Windows
    # Dispose Portrait
    @Portrait.dispose
    # Dispose Stat
    @Stat.dispose
  end
  #--------------------------------------------------------------------------
  # * Window Update 
  #--------------------------------------------------------------------------
  def update_windows
    # Update Portrait
    @Portrait.update if @Portrait.visible
    # Update Stat
    @Stat.update if @Stat.visible
  end
end

^^THis should work.
 

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