Keeping a picture on screen

SpringPie

Warper
Member
Joined
Mar 12, 2016
Messages
1
Reaction score
0
First Language
Dutch
Primarily Uses
Hello all!


If this is not the right place to post this, please feel free to put it somewhere else.


I've made an extra button in my menu called "torch" and when you click this it asks if you want to use the torch. When you click "use torch" I've got my script to show a picture and when you click "put torch away" it disposes the picture.


The problem is that when I go back to my menu, not only the window of the question and the command window disposes, but also the picture. Of course, this is not what I want. I want the picture to keep showing until I go back to my menu again and click "deactivate torch".


Does somebody know how to fix this?


This is my script:

Code:
#==============================================================================
# ** Scene_Save
#------------------------------------------------------------------------------
#  This class performs save screen processing.
#==============================================================================

class Scene_Torch
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
 def main
    # Make background transparant
    @background = Spriteset_Map.new
    # Make ask window
    @torchAsk_window = Window_TorchAsk.new
 # Make command window
    s1 = $data_system.words.item
    s2 = $data_system.words.skill
    s3 = $data_system.words.equip
    s4 = "Torch"
    s5 = "Status"
    s6 = "Save"
    s7 = "End Game"
    @commandInTorch_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7])
    @commandInTorch_window.y = 480 - @commandInTorch_window.height
    @commandInTorch_window.cursor_rect.set(0, 3 * 32, @commandInTorch_window.width - 32, 32)
    @commandInTorch_window.active = false
    # Make command window
    s1 = "Use Torch"
    s2 = "Put torch away"
    @torch_window = Window_Command.new(192, [s1, s2])
    @torch_window.x = 300
    @torch_window.y = 320
    # Make gold window
    @gold_window = Window_Gold.new
    @gold_window.x = 640 - @gold_window.width
    @gold_window.y = 0
 # Make window's opacity less
    @commandInTorch_window.back_opacity = 160  
    @torch_window.back_opacity = 160
    @torchAsk_window.back_opacity = 160
    @gold_window.back_opacity = 160
 # Execute transition
    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 window
    @torch_window.dispose
    @torchAsk_window.dispose
    @background.dispose
    @commandInTorch_window.dispose
    @gold_window.dispose
    # If switching to title screen
    if $scene.is_a?(Scene_Title)
      # Fade out screen
      Graphics.transition
      Graphics.freeze
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Update command window
    @torch_window.update
    @torchAsk_window.update
    @background.update
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Switch to menu screen
      $scene = Scene_Menu.new(3)
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Branch by command window cursor position
      case @torch_window.index
      when 0  # Torch
        command_torch
      when 1  # Torch Away
        command_torch_away
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Process When Choosing [Open Torch] Command
  #--------------------------------------------------------------------------
  def command_torch
    # Play decision SE
    $game_system.se_play($data_system.decision_se)
     # Make torch graphic
    @torchPicture = Sprite.new
    @torchPicture.bitmap = RPG::Cache.picture("Torch")
  end
  #--------------------------------------------------------------------------
  # * Process When Choosing [Close Torch] Command
  #--------------------------------------------------------------------------
  def command_torch_away
    # Play decision SE
    $game_system.se_play($data_system.decision_se)
    # Dispose of torch graphic
    @torchPicture.bitmap.dispose
    @torchPicture.dispose
  end
end
 
Last edited by a moderator:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Who's interested in voice acting?! Not me! Although not all games do it..it IS a necessary feature.
I keep snapping wireless headphones. I think thats how they get ya, good sound quality but cheap plastic...
Broke the 1,000 hour mark on MV last night! Most of that was spent on 1 project, with most of that project being worked on outside the engine so far.
School books are so expensive... I just paid a fortune. :(

Forum statistics

Threads
93,461
Messages
912,665
Members
122,996
Latest member
Whatswiththecat
Top