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.

Horizontal Command Window with icons.

I want to make a horizontal command winow but instead of commands i want to so 40x40 icons instead.Then is possible not needed the cursor underneth it. Thanks and if you need anything else explained just ask.
 
I'm pretty sure theres one of those on here somewhere... I know theres one that looks like Tales of Semphonia(?)'s menu, which has a horizontal command bar, but I'm not sure if you could make them icons, but I do believe they've got icons beside them. Thats all the help I can give. sorry.
 
Made this up real quick:
Code:
class Window_IconCommand < Window_Selectable
  
  def initialize(height, icons)
    super(0, 0, icons.size * 44 + 32, height)
    self.contents = Bitmap.new(icons.size * 40, height - 32)
    @column_max = icons.size
    @item_max = icons.size
    @icons = icons
    self.index = 0
    refresh
  end
  
  def refresh
    self.contents.clear
    for icons in @icons
      bitmap = RPG::Cache.icon(icons)
      x = @icons.index(icons) * 44
      self.contents.blt(x, 0, bitmap, Rect.new(0, 0, 40, 40))
    end
  end
  
  def update_cursor_rect
    self.cursor_rect.set(self.index * 44 - 2, -2 , 44, 44)
  end
end

Post it in a new script above main.

To use it, just use it like Window_Command.

An Example

Code:
class Scene_Something  
  alias old_main main
  alias old_update update
  
  def main
    @icon1 = "001-Weapon01"
    @icon2 = "002-Weapon02"
    @icon3 = "003-Weapon03"
    @icon_window = Window_IconCommand.new(72, [@icon1, @icon2, @icon3])
    old_main
    @icon_window.dispose
  end
  
  def update
    @icon_window.update
    old_update
  end
end
 
The window creates the width based on the icons used, but I think if you want the width to be 640 and the icons somehow centered, I think I could work something quickly. I'll edit this post when I'm done.
 

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