05-07-2010, 07:33 PM
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?
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
#===============================================================================
#===============================================================================