随便照着乱糊了一个,用法和之前一样,参考脚本开头写的格式继续写就可以了。
#============================================================================== # 本脚本来自rpg.blue,转载、使用请保留此信息 #============================================================================== module Fux2 MenuPicInfo = Struct.new(:fn,:x,:y,:opacity) PicList = {} # 格式 MenuPicInfo.new("图片名",x,y,opa),坐标和透明度可选 # 坐标不填默认0,不透明度不填默认255 PicList[1] = [ MenuPicInfo.new("变量1为0时文件名",100,100), MenuPicInfo.new("变量1为1时文件名",300,100) ] PicList[2] = [ MenuPicInfo.new("变量2为0时文件名",100,300), MenuPicInfo.new("变量2为1时文件名",300,300,180), MenuPicInfo.new("变量2为2时文件名",300,300) ] end class Scene_Menu alias _fux_start start def start _fux_start create_menu_picture end def create_menu_picture @backSprites = [] Fux2::PicList.keys.sort.each do |key| value = $game_variables[key] next if value<0 info = Fux2::PicList[key][value] spr = Sprite.new spr.bitmap = Cache.picture(info.fn) spr.x,spr.y = info.x || 0,info.y || 0 spr.opacity = info.opacity || 255 @backSprites << spr end end alias _fux_terminate terminate def terminate _fux_terminate @backSprites && @backSprites.each{|spr| spr.dispose} end end
#==============================================================================
# 本脚本来自rpg.blue,转载、使用请保留此信息
#==============================================================================
module Fux2
MenuPicInfo = Struct.new(:fn,:x,:y,:opacity)
PicList = {}
# 格式 MenuPicInfo.new("图片名",x,y,opa),坐标和透明度可选
# 坐标不填默认0,不透明度不填默认255
PicList[1] = [
MenuPicInfo.new("变量1为0时文件名",100,100),
MenuPicInfo.new("变量1为1时文件名",300,100)
]
PicList[2] = [
MenuPicInfo.new("变量2为0时文件名",100,300),
MenuPicInfo.new("变量2为1时文件名",300,300,180),
MenuPicInfo.new("变量2为2时文件名",300,300)
]
end
class Scene_Menu
alias _fux_start start
def start
_fux_start
create_menu_picture
end
def create_menu_picture
@backSprites = []
Fux2::PicList.keys.sort.each do |key|
value = $game_variables[key]
next if value<0
info = Fux2::PicList[key][value]
spr = Sprite.new
spr.bitmap = Cache.picture(info.fn)
spr.x,spr.y = info.x || 0,info.y || 0
spr.opacity = info.opacity || 255
@backSprites << spr
end
end
alias _fux_terminate terminate
def terminate
_fux_terminate
@backSprites && @backSprites.each{|spr| spr.dispose}
end
end
|