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.

Need help with horizontal menu layout [solved]

Right, in a nutshell I have a custom menu set up with 3 different pictures instead of a command window. the pictures are aligned horizontally, however, if I try to scroll left and right between them I can't, if I press up or down I can scroll through em.

I have tried a lot of things on my own but I think I'm gonna have to admit defeat and ask for a bit of help.

I cant stress enough however that I only want the horizontal scrolling for this particular scene and adjusting the number of columns in Window_Selectable also makes the title screen command window move horizontally (I want a vertical title screen)

here is the code
Code:
#==============================================================================#

#                          Basic CMS V 1.0                                     #

#       This script is a modification of Mog's Sence Menu Itigo V1.5           #

#==============================================================================#

 

module Layout

  

    # Main Menu Graphics Used

      Background       = ""       # Main Menu Graphics

  # MENU BUTTONS

      MENU_TYPE_1       = "Menu_button1"   # Button layout

      MENU_TYPE_2       = "Menu_button2"

      MENU_TYPE_3       = "Menu_button3"

    end

 

#==============================================================================

# ** Scene_Journal

#------------------------------------------------------------------------------

#  This class performs journal screen processing.

#==============================================================================

 

class Scene_Menu

  #--------------------------------------------------------------------------

  # * 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

    s1 = ""

    s2 = ""

    s3 = ""

    @command_window = Window_Command.new(160, [s1, s2, s3])

    @command_window.index = @menu_index

    @command_window.opacity = 0

    @command_window.windowskin = RPG::Cache.windowskin("")

    # Draws the pictures for the menu

    @mnlay = Sprite.new

    @mnlay.bitmap = RPG::Cache.picture(Layout::Background)

    @mnlay.opacity = 255

    @mncom = Sprite.new

    @mncom.bitmap = RPG::Cache.picture(Layout::MENU_TYPE_1)

    @mncom.z = 100

    # 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

    @mnlay.dispose

    @mncom.dispose

    # Dispose of windows

    @command_window.dispose

  end

  #--------------------------------------------------------------------------

  # * Frame Update

  #--------------------------------------------------------------------------

  def update

    # Update windows

    @command_window.update

    # If command window is active: call update_command

    if @command_window.active

      update_command

      return

    end

  end

  def update_command

    case @command_window.index 

    when 0  

    @mncom.bitmap = RPG::Cache.picture(Layout::MENU_TYPE_1)

    when 1

    @mncom.bitmap = RPG::Cache.picture(Layout::MENU_TYPE_2)

    when 2

    @mncom.bitmap = RPG::Cache.picture(Layout::MENU_TYPE_3)

  end

    if Input.trigger?(Input::B)

  # If the player presses cancel, what do you want it to do

      $game_system.se_play($data_system.cancel_se)

      $scene = Scene_Map.new

  # Replace $scene = Scene_Menu.new with whichever scene you want

  # to return to after they cancel this menu.

  # to return to the map replace it with, $scene = Scene_Map.new

      return

    end

    if Input.trigger?(Input::C)

  # If the player presses the confirm button...

      case @command_window.index

      when 0 

  # and the first option is selected

        $game_system.se_play($data_system.decision_se)

        $scene = Scene_Item.new

      when 1 

  # and the second option is selected

        $game_system.se_play($data_system.decision_se)

        $scene = Scene_Save.new

      when 2 

  # and the third option is selected

        $game_system.se_play($data_system.decision_se)

        $scene = Scene_End.new

      end

# Keep in mind, Whatever scene you transfer to will still exit into whatever

# Menu it is defined to exit into, NOT this one (unless you change it to this 1)

    end

  end

end

the 3 pictures are just 3 boxes with text that each have a different one highlighted btw.

please someone help me as I dont want to continue with my project until I have the menu sorted.

thanks.
 
Sounds like you have have just 1 column on it's side. The window_command has a default column_max of 1. Which is why left and right don't do anything.

I think adding @column_max = 3 anywhere around line 40 should do the trick. I think.
 
I was talking about the code that you posted.
I just checked XP's window_selectable class and it does have a column_max set to 1 under initialize. But changing that would change every window. You just want your CMS to have a 3 columns; so in your code right after @command_window = Window_Command.new(160, [s1, s2, s3]) at line 40 you would set the column max.
You can see how Window_Item uses a @column_max=2
 
Hang on, I almost had it. I was looking at my menus I did in VX and thought I figure it out. But XP doesn't have the column max in it's window_command method.
If it was VX It would look like this:
@command_window = Window_Command.new(160, [s1, s2, s3],Column_max, row_max, spacing)

But XP stops at the width and commands. I see what you meant earlier. I suppose you could edited Xp's command window to include it. But I feel like it should a place to just plug in the column setting.
 

Jason

Awesome Bro

Not that I know since it's been forever since I've used XP, let alone scripted with it... but couldn't you take a look at how columns are done in the item command windows? Surely that could point you in the right direction... right?
 
You could just make a copy of the Window_Command class but rename it Window_Horz. Add the columns and any other adjustments.

Then instead of
@command_window = Window_Command.new(160, [s1, s2, s3])
use
@command_window = Window_Horz.new(160, [s1, s2, s3])

It's a not efficient since it's repetitive code. But who cares?
 
finally got my computer working again.

coyote you absolute beast, I just copied the window_selectable and window_command scripts, added a 2 to the end of each of em, set window_selectable2 to run 3 columns, set window_command2 to run off of window_selectable2 and set my menu to run off of window_command2.

blindingly simple, but somehow I missed it.

thank you so much for your help.
 

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