#==============================================================================
# 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
#==============================================================================
#==============================================================================
# ■ 图片标题菜单1.0
# Scene_Title
#------------------------------------------------------------------------------
# 作者:chaochao
# [url]http://zhuchao.go1.icpcn.com[/url]
#==============================================================================
class Scene_Title
def main
if $BTEST
battle_test
return
end
$data_actors = load_data("Data/Actors.rxdata")
$data_classes = load_data("Data/Classes.rxdata")
$data_skills = load_data("Data/Skills.rxdata")
$data_items = load_data("Data/Items.rxdata")
$data_weapons = load_data("Data/Weapons.rxdata")
$data_armors = load_data("Data/Armors.rxdata")
$data_enemies = load_data("Data/Enemies.rxdata")
$data_troops = load_data("Data/Troops.rxdata")
$data_states = load_data("Data/States.rxdata")
$data_animations = load_data("Data/Animations.rxdata")
$data_tilesets = load_data("Data/Tilesets.rxdata")
$data_common_events = load_data("Data/CommonEvents.rxdata")
$data_system = load_data("Data/System.rxdata")
$game_system = Game_System.new
# 生成标题图形
[url=home.php?mod=space&uid=114926]@sprite[/url] = [Sprite.new]
for i in 0..8
@sprite[i] = Sprite.new
@sprite[i].opacity = 0
end
# 生成标题图形
@titleback = Sprite.new
@titleback.bitmap = Bitmap.new(640, 480)
#生成标题变换图形
@titlesp = Sprite.new
@titlespbmp = []
for j in 0...3
@titlespbmp[j] = Bitmap.new("Graphics/Titles/标题" + (j + 1).to_s)
end
#
@titlesp.opacity = 127
@titlesp.bitmap = @titlespbmp[0]
@bmpsequence = 0
@bmpopacity = 255
@bmpdirect = 1
@titleback.bitmap.fill_rect(0, 0, 640, 480, Color.new(255, 255, 255, 255))
#
# 随机人物
randpeople = rand(2)
#生成人物
@lidelu = Sprite.new
@lidelubmp = []
for j in 0...3
case randpeople
when 0
@lidelubmp[j] = Bitmap.new("Graphics/Titles/莉德露" + (j + 1).to_s)
when 1
@lidelubmp[j] = Bitmap.new("Graphics/Titles/巫女" + (j + 1).to_s)
end
end
@lidelu.bitmap = @lidelubmp[0]
@lidelu.x = 300
@lidelu.y = 120
@lidelu.z = 9999
@lidelublinkcount = 0
###
@sprite[0].bitmap = RPG::Cache.title($data_system.title_name)
@sprite[0].opacity = 0
@sprite[0].z =9999
#开始游戏的图片
@sprite[1].bitmap = Bitmap.new("Graphics/Titles/开始1.png")
@sprite[2].bitmap = Bitmap.new("Graphics/Titles/开始2.png")
@sprite[1].z =9999
@sprite[2].z =9999
#继续游戏的图片
@sprite[3].bitmap = Bitmap.new("Graphics/Titles/继续1.png")
@sprite[4].bitmap = Bitmap.new("Graphics/Titles/继续2.png")
@sprite[3].z =9999
@sprite[4].z =9999
#结束游戏的图片
@sprite[5].bitmap = Bitmap.new("Graphics/Titles/人物1.png")
@sprite[6].bitmap = Bitmap.new("Graphics/Titles/人物2.png")
@sprite[5].z =9999
@sprite[6].z =9999
#第四项的图片
@sprite[7].bitmap = Bitmap.new("Graphics/Titles/退出1.png")
@sprite[8].bitmap = Bitmap.new("Graphics/Titles/退出2.png")
@sprite[7].z =9999
@sprite[8].z =9999
#图片位置
for i in 1..8
x=135
y=(i+1)/2*35+240
@sprite[i].x =x
@sprite[i].y =y
end
@continue_enabled = false
for i in 0..3
if FileTest.exist?("Save#{i+1}.rxdata")
@continue_enabled = true
end
end
if @continue_enabled
@command_index = 1
else
@command_index = 0
@sprite[3].tone = Tone.new(0, 0, 0, 255)
@sprite[4].tone = Tone.new(0, 0, 0, 255)
end
$game_system.bgm_play($data_system.title_bgm)
Audio.me_stop
Audio.bgs_stop
Graphics.transition
loop do
Graphics.update
#淡出背景圖形
if @sprite[0].opacity <= 255
@sprite[0].opacity += 15
end
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
# 釋放圖形
@titleback.bitmap.dispose
@titleback.dispose
for j in 0...3
@titlespbmp[j].dispose
end
@lidelu.dispose
for j in 0...3
@lidelubmp[j].dispose
end
@titlesp.dispose
for i in 0..8
@sprite[i].bitmap.dispose
@sprite[i].dispose
end
end
def update
chaochaocommandchaochao
if Input.trigger?(Input::C)
case @command_index
when 0
command_new_game
when 1
command_continue
when 2
when 3
command_shutdown
end
end
# 更新背景图片
if @bmpdirect > 0
@bmpopacity += 10
if @bmpopacity >= 1200
@bmpdirect = -1
end
else
@bmpopacity -= 10
if @bmpopacity <= 0
@bmpdirect = 1
# 更换人物和背景图片
@bmpsequence = (@bmpsequence + 1) % 3
@titlesp.bitmap = @titlespbmp[@bmpsequence]
end
end
#更换图片操作
@titlesp.opacity = (@bmpopacity > 255 ? 127 : @bmpopacity / 2)
@lidelublinkcount = (@lidelublinkcount + 1) % 60
@lidelu.bitmap = @lidelubmp[@lidelublinkcount >= 52 ? 1 : 0]
end
#
def chaochaocommandchaochao
if Input.trigger?(Input::UP)
@command_index -= 1
if @command_index < 0
@command_index = 3
end
$game_system.se_play($data_system.cursor_se)
end
if Input.trigger?(Input::DOWN)
@command_index += 1
if @command_index > 3
@command_index = 0
end
$game_system.se_play($data_system.cursor_se)
end
case @command_index
when 0
if @sprite[1].opacity >= 0
@sprite[1].opacity -= 30
end
if @sprite[2].opacity <= 240
@sprite[2].opacity += 30
end
if @sprite[3].opacity <= 210
@sprite[3].opacity += 30
end
if @sprite[4].opacity >= 0
@sprite[4].opacity -= 30
end
if @sprite[5].opacity <= 210
@sprite[5].opacity += 30
end
if @sprite[6].opacity >= 0
@sprite[6].opacity -= 30
end
if @sprite[7].opacity <= 210
@sprite[7].opacity += 30
end
if @sprite[8].opacity >= 0
@sprite[8].opacity -= 30
end
when 1
if @sprite[1].opacity <= 210
@sprite[1].opacity += 30
end
if @sprite[2].opacity >= 0
@sprite[2].opacity -= 30
end
if @sprite[3].opacity >= 0
@sprite[3].opacity -= 30
end
if @sprite[4].opacity <= 240
@sprite[4].opacity += 30
end
if @sprite[5].opacity <= 210
@sprite[5].opacity += 30
end
if @sprite[6].opacity >= 0
@sprite[6].opacity -= 30
end
if @sprite[7].opacity <= 210
@sprite[7].opacity += 30
end
if @sprite[8].opacity >= 0
@sprite[8].opacity -= 30
end
when 2
if @sprite[1].opacity <= 210
@sprite[1].opacity += 30
end
if @sprite[2].opacity >= 0
@sprite[2].opacity -= 30
end
if @sprite[3].opacity <= 210
@sprite[3].opacity += 30
end
if @sprite[4].opacity >= 0
@sprite[4].opacity -= 30
end
if @sprite[5].opacity >= 0
@sprite[5].opacity -= 30
end
if @sprite[6].opacity <= 240
@sprite[6].opacity += 30
end
if @sprite[7].opacity <= 210
@sprite[7].opacity += 30
end
if @sprite[8].opacity >= 0
@sprite[8].opacity -= 30
end
when 3
if @sprite[1].opacity <= 210
@sprite[1].opacity += 30
end
if @sprite[2].opacity >= 0
@sprite[2].opacity -= 30
end
if @sprite[3].opacity <= 210
@sprite[3].opacity += 30
end
if @sprite[4].opacity >= 0
@sprite[4].opacity -= 30
end
if @sprite[7].opacity >= 0
@sprite[7].opacity -= 30
end
if @sprite[8].opacity <= 240
@sprite[8].opacity += 30
end
if @sprite[5].opacity <= 210
@sprite[5].opacity += 30
end
if @sprite[6].opacity >= 0
@sprite[6].opacity -= 30
end
end
end
end