Save-Point
Window Visibility Problem - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Games Development (https://www.save-point.org/forum-4.html)
+--- Forum: Code Support (https://www.save-point.org/forum-20.html)
+--- Thread: Window Visibility Problem (/thread-257.html)



Window Visibility Problem - computerwizoo7 - 05-07-2010

Window Visibility Problem

so, i made a window with an image, the players lv, and the players HP and SP/MP(its called in my game).

anyway, when i set the visibility to false, the window goes away but the lv1 and the HP/SP remains!

What is the problem? is there a property or something i should use to get the lv and HP/SP to go away as well?

Code:
#===============================================================================
#BrainWiz Hud
#Author: computerwizoo7
#===============================================================================
module POSITION
#===============================================================================
  HUD_X = 0
  HUD_Y = 224
  HUD_X2 = 0
  HUD_Y2 = 352
  HUD_Z = 1
  OPACITY = 0
end
#===============================================================================
#===============================================================================
class Window_Hud < Window_Base
#===============================================================================
  def initialize
    super(POSITION::HUD_X,POSITION::HUD_Y,128,128)
    self.contents = Bitmap.new(width - 32,height - 32)
    self.visible = $game_switches[19]
    @back_img = Sprite.new
    @back_img.bitmap = Cache.picture("hud_back")
    @back_img.visible = $game_switches[19]
    @back_img.x = POSITION::HUD_X
    @back_img.y = POSITION::HUD_Y
    @back_img.z = POSITION::HUD_Z
    self.opacity = POSITION::OPACITY
    refresh
  end
  def refresh
    self.contents.clear
    draw_actor_face($game_party.members[0],0,0,96)
    draw_actor_level($game_party.members[0], 0, 0)
    draw_actor_hp_gauge($game_party.members[0], 0, 70, width = 96)
    draw_actor_mp_gauge($game_party.members[0], 0, 75, width = 96)
  end
  def update
    if $game_switches[19] == true
    #self.visible = $game_switches[19]
    #@back_img.visible = $game_switches[19]
    if Input.trigger?(Input::X)
      self.visible = true
      @back_img.visible = true
      Audio.se_play("Audio/SE/Wind7", 60, 100)
#~         self.opacity = 0
#~         @back_img.opacity = 0
#~         $game_switches[19] = false
#~            self.ox = -128
    end
    if Input.trigger?(Input::Y)
      self.visible = false
      @back_img.visible = false
      Audio.se_play("Audio/SE/Wind7", 60, 100)
#~         self.opacity = 255
#~         @back_img.opacity = 255
#~         $game_switches[19] = true
    end
    end
    if $game_switches[19] == false
      self.visible = false
      @back_img.visible = false
    end
    @back_img.update
    refresh
  end
end
#===============================================================================
#===============================================================================
class Window_Hud_2 < Window_Base
#===============================================================================
  def initialize
    super(POSITION::HUD_X2,POSITION::HUD_Y2,128,64)
    self.contents = Bitmap.new(width - 32,height - 32)
    self.visible = $game_switches[19]
    @back_img2 = Sprite.new
    @back_img2.bitmap = Cache.picture("hud_back2")
    @back_img2.visible = $game_switches[19]
    @back_img2.x = POSITION::HUD_X2
    @back_img2.y = POSITION::HUD_Y2
    @back_img2.z = POSITION::HUD_Z
    self.opacity = POSITION::OPACITY
    refresh
  end
  def refresh
    self.contents.clear
    draw_actor_state($game_party.members[0], 0, 0, 96)
  end
  def update
    if $game_switches[19] == true
    #self.visible = $game_switches[19]
    #@back_img2.visible = $game_switches[19]
    if Input.trigger?(Input::X)
      self.visible = true
      @back_img2.visible = true
      Audio.se_play("Audio/SE/Wind7", 60, 100)
#~         self.opacity = 0
#~         @back_img2.opacity = 0
#~         $game_switches[19] = false
    end
    if Input.trigger?(Input::Y)
      self.visible == false
      @back_img2.visible = false
      Audio.se_play("Audio/SE/Wind7", 60, 100)
#~         self.opacity = 255
#~         @back_img2.opacity = 255
#~         $game_switches[19] = true
    end
  end
  if $game_switches[19] == false
    self.visible = false
    @back_img2.visible = false
  end
  @back_img2.update
  refresh
  end
end
#===============================================================================
#===============================================================================
class Scene_Map
#===============================================================================
  alias hudmain main
  alias hudupdate update
  alias hudterminate terminate
  def main
    @Huda = Window_Hud.new
    @Hudb = Window_Hud_2.new
    hudmain
  end
  def update
    @Huda.update
    @Hudb.update
    hudupdate
  end
  def terminate
    @Huda.dispose
    @Hudb.dispose
    hudterminate
  end
end
#===============================================================================
#===============================================================================



[Resolved] Window Visibility Problem - Kread-EX - 05-07-2010

You could try to use self.contents_opacity = 0.


[Resolved] Window Visibility Problem - computerwizoo7 - 05-07-2010

no, that wont work. It will only make the window invisible, the same thing as self.visible = false.


[Resolved] Window Visibility Problem - deValdr - 05-10-2010

I don't think so actually. You should try.


[Resolved] Window Visibility Problem - computerwizoo7 - 05-10-2010

i tried already.
it dont work.
the text is under the image but not the bitmap.


[Resolved] Window Visibility Problem - deValdr - 05-10-2010

Change the refresh method to

draw_text if self.visible == true


[Resolved] Window Visibility Problem - computerwizoo7 - 05-10-2010

I fixed it! ^_^
I'm cool!

its not what you said Valred!

i noticed that the z index for window base is 100 so i just overwrite it for my hud.


[Resolved] Window Visibility Problem - deValdr - 05-10-2010

good work. I'm happy as well Cheery, you misspelled my username valred, and not "vladred" as most people do.