class Floating < Sprite
SWITCH_TO_ITEM = {
10 => 50,
11 => 51
}
def initialize(viewport = nil)
super(viewport)
self.bitmap = Bitmap.new(96, 32)
self.x = 640 - 96
self.z = 1000
@item = 0
end
def dispose
self.bitmap.dispose
super
end
def update
super
SWITCH_TO_ITEM.each_key { |i|
if $game_switches && @item != i
bitmap = RPG::Cache.icon($data_items[SWITCH_TO_ITEM].icon_name)
self.bitmap.blt(4, 4, bitmap, Rect.new(0, 0, 24, 24))
self.bitmap.draw_text(32, 4, 64, 32,
sprintf("×%3d", $game_party.item_number(i)))
@item = i
return
end
}
end
end
class Scene_Map
alias main_old main if !method_defined? :main_old
def main
@floating = Floating.new
main_old
@floating.dispose
end
alias update_old update if !method_defined? :update_old
def update
@floating.update
update_old
end
end
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |