I'm having a few troubles with my images for my shop buy menu, the image appears up the call of the shop, but i onlt want it to appear when i select the buy option. Does anybody know how to sort this little problem.
Code:
#==============================================================================
# ** Window_Tactics_ShopBuy
#------------------------------------------------------------------------------
# This window displays buyable goods on the shop screen.
#==============================================================================
class Window_Tactics_ShopBuy < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
# shop_goods : goods
#--------------------------------------------------------------------------
def initialize(shop_goods)
super(20, 20, 600, 228)
self.contents = Bitmap.new(width - 32, row_max * 32)
@SHOPBACK_graphic = Sprite.new
@SHOPBACK_graphic.x = self.x + 1
@SHOPBACK_graphic.y = self.y + 1
@SHOPBACK_graphic.z = self.z + 1
self.opacity = 0
@shop_goods = shop_goods
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# * Item Acquisition
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for goods_item in @shop_goods
case goods_item[0]
when 0
item = $data_items[goods_item[1]]
when 1
item = $data_weapons[goods_item[1]]
when 2
item = $data_armors[goods_item[1]]
end
if item != nil
@data.push(item)
end
end
# If item count is not 0, make a bit map and draw all items
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
# Get items in possession
case item
when RPG::Item
number = $game_party.item_number(item.id)
equipped_number = 0
when RPG::Weapon
number = $game_party.weapon_number(item.id)
equipped_number = $game_party.equipped_weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
equipped_number = $game_party.equipped_armor_number(item.id)
end
# If price is less than money in possession, and amount in possession is
# not 99, then set to normal text color. Otherwise set to disabled color
if item.price <= $game_party.gold and number < 99
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4
y = index * 32
rect = Rect.new(x, y, self.width - 32, 32)
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
@SHOPBACK_graphic.bitmap = RPG::Cache.picture('Shop Window')
@SHOPBACK_graphic.visible = true
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.draw_text(x + 370, y, 88, 32, (number + equipped_number).to_s, 2)
self.contents.draw_text(x + 290, y, 88, 32, equipped_number.to_s, 2)
self.contents.draw_text(x + 460, y, 88, 32, item.price.to_s, 2)
end
def dispose
@SHOPBACK_graphic.dispose
end
#--------------------------------------------------------------------------
# * Help Text Update
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end