Window Visibility Problem
#1
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
#===============================================================================
#===============================================================================
[Image: gen-sig.png]
Reply }
#2
You could try to use self.contents_opacity = 0.
Reply }
#3
no, that wont work. It will only make the window invisible, the same thing as self.visible = false.
Reply }
#4
I don't think so actually. You should try.
Reply }
#5
i tried already.
it dont work.
the text is under the image but not the bitmap.
Reply }
#6
Change the refresh method to

draw_text if self.visible == true
Reply }
#7
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.
Reply }
#8
good work. I'm happy as well Cheery, you misspelled my username valred, and not "vladred" as most people do.
Reply }


Possibly Related Threads…
Thread Author Replies Views Last Post
   The z-space problem of displaying sprites icogil 28 13,086 03-05-2023, 03:31 AM
Last Post: DerVVulfman
   Sorting Items in Shop Window Mel 13 18,082 01-18-2018, 05:49 AM
Last Post: DerVVulfman
   Showing only specific skills in a window Mel 2 5,956 01-12-2016, 01:34 PM
Last Post: Mel
   Problem with drain script form the ATOA ACBS Djigit 2 5,644 07-12-2015, 09:17 PM
Last Post: Djigit
   Event collision problem with FPLE script ThePrinceofMars 2 5,844 11-11-2014, 06:30 PM
Last Post: ThePrinceofMars
  Custom meter problem daylights 13 16,405 08-12-2013, 03:34 AM
Last Post: daylights
  Changing Window Styles in Game JackMonty 8 11,249 03-22-2013, 11:54 PM
Last Post: JackMonty
   [RUBY] Depack Thread Problem Narzew 1 4,438 07-20-2012, 01:16 PM
Last Post: Narzew
   Advantages & Charlie Fleed CTB problem Yin 7 12,112 12-12-2011, 03:45 PM
Last Post: Yin
   Something I noticed about the Advanced Shop Status Window yamina-chan 5 10,105 08-21-2011, 09:16 PM
Last Post: yamina-chan



Users browsing this thread: 2 Guest(s)