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.

Icon Command help

I'm trying to make my own command window for horizontal icon commands. So far, I've gotten to this:

Code:
#==============================================================================
# Window Battle Command
#==============================================================================
class Window_BattleCommand < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(width = 160, icons = [])
    super(0, 0, width, icons.size * 32 + 32)
    self.contents = Bitmap.new(width - 32, height - 32)
    @icons = icons
    refresh
    self.index = 0
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    for i in 0...@item_max
      draw_item(i, normal_color)
    end
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #--------------------------------------------------------------------------
  def draw_item(index, color)
    y = index * 32
    # Clears Area
    self.contents.fill_rect(0, y, contents.width, 32, Color.new(0, 0, 0, 0))
    # Draws Icon
    bitmap = RPG::Cache.icon(@icons[index])
    self.contents.blt(4, y + 4, bitmap, Rect.new(0, 0, 24, 24), color.alpha)
  end
  #--------------------------------------------------------------------------
  # * Disable Item
  #     index : item number
  #--------------------------------------------------------------------------
  def disable_item(index)
    draw_item(index, disabled_color)
  end
end

I'm trying to get it to look like this:

http://img224.imageshack.us/img224/9258 ... temgm7.png[/IMG]

The only problem so far, is that only one icon shows up. I have no clue where this error is coming from.
 

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