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.

Custom Window_Command won't let me move the cursor

This is a very strange problem: I've created a new Window_Command, but for some reason it won't update the cursor position. The selection box appears, but if you press up or down it doesn't go up or down. I've used Scene_Menu as a template, but I can't see any differences between mine and Scene_Menu that would allow it to work, but not mine. I even checked Window_Command to make sure that it handles input, and sure enough it does. So why doesn't mine work?

PHP:
class Repository_Menu
	#Display welcome text, present with choices #no choice
#--------------------------------------------------------------------------
  # * Object Initialization
  #     menu_index : command cursor's initial position
  #--------------------------------------------------------------------------
	def initialize(menu_index = 0)
		@menu_index = menu_index
	end
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # Make command window
    commands = []
    i = 10
    for i in 10 ... 20 
      if $game_switches[i] == true
        commands.push($idLookup[i-10])
      end
    end
    @command_window = Window_Command.new(230, commands)
    @command_window.index = 0
	 # Execute transition
    Graphics.transition
    # Main loop
    loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      # Frame update #how long do you think you have?
      update
      # Abort loop if screen is changed
      if $scene != self
        break
      end
    end
    # Prepare for transition
    Graphics.freeze
    # Dispose of windows
    @command_window.dispose
	end
	def refresh
		
	end
	
	def update
	# If B button was pressed
	    if Input.trigger?(Input::B)
	      # Play cancel SE #on this planet
        if @detailWindow == nil || @detailWindow.disposed?
          $game_system.se_play($data_system.cancel_se)
          # Switch to map screen
          $scene = Scene_Map.new
        else
          $game_system.se_play($data_system.cancel_se)
          @detailWindow.dispose
        end
	      return
	    end
		if Input.trigger?(Input::C) && (@detailWindow == nil || @detailWindow.disposed?)
      # Choose a topic, create a new window to show data on that topic. 
      $game_system.se_play($data_system.decision_se)
      # Creates a new window that will draw the text of the topic selected
      @detailWindow = Repository_Topics.new(@command_window.index)
    end
  end
end
 

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