Need help with my menu - Current issue is item grid layout
#11
I always seem to flip scripts around a bit and break them into modules of their own. Hell, I took the filenames and put them into a separate LilyFrog config module:
Code:
module LilyMenu
  
  # HERO'S VARIABLE OF CHOICE
  # =========================
  #
    HEROVARIABLE = 1
  
  # MENU BACKGROUND
  # ===============
  #
    MENUBACK = [ 'backtest1', 'backtest2'  ]

  # HERO'S EMOTIONAL REACTION
  # =========================
  #
    HEROFACE  = [ 'hanneutral', 'hanworry', 'penneutral', 'penhappy',
                  'penworry',   'penpsych', 'penaffect' ]
  
  # HERO'S NAME
  # ===========
  #
    HERONAME = [ 'testname1', 'testname2'  ]                  
    

end

#==============================================================================
# ** Menu_Graphics
#------------------------------------------------------------------------------
#  This window displays the main window for LilyFrog's game using graphics
#  based on standard RMXP game variables
#==============================================================================

class Menu_Graphics < Window_Base
  #----------------------------------------------------------------------
  # * Object Initialization
  #----------------------------------------------------------------------
  def initialize
    super(0, 0, 640, 480)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity  = 0
    # Acquire value of game variable
    gamevar = $game_variables[LilyMenu::HEROVARIABLE]
    # Now draw them
    initialize_background(gamevar)
    initialize_character_graphic(gamevar)
    initialize_character_name(gamevar)
  end
  #-----------------------------------------------------------------------
  # * Draw Background
  #     gamevar : game variable data
  #-----------------------------------------------------------------------
  def initialize_background(gamevar)
    # Create the Background Sprite and set position
    @menuback     = Sprite.new
    @menuback.x   = 0
    @menuback.y   = 0
    # Determine Background based on game variable state
    temp_image = (gamevar < 5 ) ? LilyMenu::MENUBACK[0] : LilyMenu::MENUBACK[1]
    # Load Background Bitmap
    @menuback.bitmap = RPG::Cache.picture(temp_image)
  end
  #-----------------------------------------------------------------------
  # * Draw Character Graphic
  #     gamevar : game variable data
  #-----------------------------------------------------------------------
  def initialize_character_graphic(gamevar)
    # Create the character graphic and set position
    @charactergraphic     = Sprite.new    
    @charactergraphic.x   = 375
    @charactergraphic.y   = 50
    # Acquire image from array by game variable data
    temp_image = LilyMenu::HEROFACE[gamevar]
    # Draw image
    @charactergraphic.bitmap = RPG::Cache.picture(temp_image)
  end
  #-----------------------------------------------------------------------
  # * Character Names And Changes
  #     gamevar : game variable data
  #-----------------------------------------------------------------------
  def initialize_character_name(gamevar)
    # Create the character name display and set position
    @charactername    = Sprite.new    
    @charactername.x  = 310
    @charactername.y  = 15
    # Acquire image from array by game variable data
    temp_image = (gamevar <= 2 ) ? LilyMenu::HERONAME[0] : LilyMenu::HERONAME[1]
    # Draw image
    @charactername.bitmap = RPG::Cache.picture(temp_image)
  end
end

I hate those icon menus. They give ME headaches. Unless you have something that overwrites the default hidden Window class, remember that you should have a 16px border around everything. So if you have a window with 4qty 32x32 icons, it isn't the space of 32x4 (or 128), but with 16px on either side too... (128+32 ... aka 160) That eliminates the scrolling arrow appearing on the right.

EDIT: There was a flub in the initial posting of the script.
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)

[Image: QrnbKlx.jpg]
[Image: sGz1ErF.png]    [Image: liM4ikn.png]    [Image: fdzKgZA.png]    [Image: sj0H81z.png]
[Image: QL7oRau.png]    [Image: uSqjY09.png]    [Image: GAA3qE9.png]    [Image: 2Hmnx1G.png]    [Image: BwtNdKw.png%5B]
  Above are clickable links
Reply }


Messages In This Thread
RE: Need help with my menu - Current issue is item grid layout - by DerVVulfman - 09-05-2018, 05:17 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
   Plugin or Script help with Item menu, SKill menu, and Equip menu JayRay 2 59 Yesterday, 03:09 AM
Last Post: JayRay
   I want to merge item classification and description extensions. zlsl 7 9,584 11-25-2019, 06:46 AM
Last Post: kyonides
   Handling very long Item Names Mel 4 8,229 09-24-2018, 06:37 PM
Last Post: Mel
   Special Items Separate Menu Diorm 41 42,397 02-10-2018, 06:06 PM
Last Post: Diorm
Question  Mog Menu script: help me stop the crazy picture movement during transitions Zachariad 4 9,843 05-31-2017, 05:10 AM
Last Post: Zachariad
   A fourth column in MOG Scene Item Laura V1.2 Noctis 13 20,319 11-27-2016, 05:12 PM
Last Post: DerVVulfman
   Bizarre issue with Lanzer counter script. Steel Beast 6Beets 2 7,240 10-04-2016, 11:46 AM
Last Post: Steel Beast 6Beets
   XAIL MENU from RPG VX ACE to RPG XP RASHIDA12 46 52,071 05-02-2016, 08:08 PM
Last Post: RASHIDA12
Tongue  Healing Spell doesn't work right in Menu? Bounty Hunter Lani 8 12,477 01-15-2015, 07:45 PM
Last Post: Bounty Hunter Lani
   My Options Menu needs help firestalker 0 3,287 08-11-2014, 02:31 PM
Last Post: firestalker



Users browsing this thread: 1 Guest(s)