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.

Showing icons for equipped items

Howdy, I am making yet another new Hud for my game...

I am going to have it show the icons for the equipped items at the bottom of the screen.

I need to know what I need to put to show these icons.

For example, I want to show the equipped weapon's icon, what do I put to show this icon?
 
Here you go, insert this above main:

Code:
class Spriteset_Map
  alias icon_init initialize
  alias icon_dispose dispose
  def initialize
    icon_init
    bitmap = Bitmap.new(32, 160)
    unless $game_party.actors[0].weapon_id == 0
      icon = $data_weapons[$game_party.actors[0].weapon_id].icon_name
      bitmap.blt(0, 0, RPG::Cache.icon(icon), Rect.new(0, 0, 24, 24))
    end
    for i in 1..4
      case i
      when 1
        next if $game_party.actors[0].armor1_id == 0
        icon = $data_armors[$game_party.actors[0].armor1_id].icon_name
      when 2
        next if $game_party.actors[0].armor2_id == 0
        icon = $data_armors[$game_party.actors[0].armor2_id].icon_name
      when 3
        next if $game_party.actors[0].armor3_id == 0
        icon = $data_armors[$game_party.actors[0].armor3_id].icon_name
      when 4
        next if $game_party.actors[0].armor4_id == 0
        icon = $data_armors[$game_party.actors[0].armor4_id].icon_name
      end
      bitmap.blt(0, i*32, RPG::Cache.icon(icon), Rect.new(0, 0, 24, 24))
    end
    @icon_sprite = Sprite.new
    @icon_sprite.bitmap = bitmap
    @icon_sprite.x = 8
    @icon_sprite.y = 320
    @icon_sprite.z = 500
  end
  def dispose
    icon_dispose
    @icon_sprite.dispose
  end
end
 
Find the lines that sets the icon sprite's x and y values towards the bottom and change them.

Or if you mean, you want them to be horizontal or something, let me know and I'll change it.
 
So you don't want an icon for the weapon? You only listed four.

Either way, is this what you wanted?
Code:
class Spriteset_Map
  alias icon_init initialize
  alias icon_dispose dispose
  def initialize
    icon_init
    bitmap = Bitmap.new(250, 32)
    unless $game_party.actors[0].weapon_id == 0
      icon = $data_weapons[$game_party.actors[0].weapon_id].icon_name
      bitmap.blt(0, 0, RPG::Cache.icon(icon), Rect.new(0, 0, 24, 24))
    end
    for i in 1..4
      case i
      when 1
        next if $game_party.actors[0].armor1_id == 0
        icon = $data_armors[$game_party.actors[0].armor1_id].icon_name
      when 2
        next if $game_party.actors[0].armor2_id == 0
        icon = $data_armors[$game_party.actors[0].armor2_id].icon_name
      when 3
        next if $game_party.actors[0].armor3_id == 0
        icon = $data_armors[$game_party.actors[0].armor3_id].icon_name
      when 4
        next if $game_party.actors[0].armor4_id == 0
        icon = $data_armors[$game_party.actors[0].armor4_id].icon_name
      end
      bitmap.blt(i*50, 0, RPG::Cache.icon(icon), Rect.new(0, 0, 24, 24))
    end
    @icon_sprite = Sprite.new
    @icon_sprite.bitmap = bitmap
    @icon_sprite.x = 222
    @icon_sprite.y = 417
    @icon_sprite.z = 500
  end
  def dispose
    icon_dispose
    @icon_sprite.dispose
  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