=begin
================================================================================
滚动图片式标题
________________________________________________________________________________
【版本历史】
版本 日期 备注
----- ----------- ----------------------------------------------------
2.0 ... 2018.10.07 ... 脚本结构优化;代码规范化;增加范例工程
1.0 ... 2012.10.07 ... 最初版本
________________________________________________________________________________
【简介】
仿照 XAS 3.82 的标题画面,在标题中加入全景图及雾图形,增强视觉效果。
________________________________________________________________________________
【使用方式】
替换默认的 Scene_Title,或插入到 Main 之前。
________________________________________________________________________________
【作者】
失落的乐章
================================================================================
=end
module SGSTITLE
# 固定标题图的路径(若为 nil 则采用数据库中设置的标题画面图形)
TITLE = nil
# 固定标题图显示方式(0:在滚动背景图与雾图形之下;
# 1:在背景图之上,雾图形之下;2:在滚动背景图与雾图形之上)
TYPE = 1
# 固定标题图的原点
TITLE_OX = 0
TITLE_OY = 0
# 固定标题图的坐标
TITLE_X = 50
TITLE_Y = 111
# 滚动背景图的路径
PLANE = "Graphics/Panoramas/001-Sky01.jpg"
# 滚动背景图不透明度
PLANE_OPACITY = 120
# 背景图滚动速度
PLANE_OX = 1
PLANE_OY = 1
# 雾图形的路径
FOG = "Graphics/Fogs/001-Fog01.png"
# 雾图形不透明度
FOG_OPACITY = 50
# 雾图形合成方式(0:正常;1:加法;2:减法)
FOG_BLEND_TYPE = 1
# 雾图形滚动速度
FOG_OX = -1
FOG_OY = 1
end
class Scene_Title
include SGSTITLE
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
s1 = "新游戏"
s2 = "继续"
s3 = "退出"
@command_window = Window_Command.new(192, [s1, s2, s3])
@command_window.back_opacity = 160
@command_window.x = 320 - @command_window.width / 2
@command_window.y = 288
@continue_enabled = false
@plane = Plane.new
@plane.bitmap = Bitmap.new(PLANE)
@plane.z = 2
@fog = Plane.new
@fog.bitmap = Bitmap.new(FOG)
@fog.opacity = FOG_OPACITY
@fog.blend_type = FOG_BLEND_TYPE
@fog.z = 4
@title = Sprite.new
@title.bitmap = TITLE ? Bitmap.new(TITLE) : RPG::Cache.title($data_system.title_name)
@title.ox = TITLE_OX
@title.oy = TITLE_OY
@title.x = TITLE_X
@title.y = TITLE_Y
@title.z = case TYPE
when 0 then 1
when 1 then 3
when 2 then 5
else 5
end
for i in 0..3
if FileTest.exist?("Save#{i+1}.rxdata")
@continue_enabled = true
end
end
if @continue_enabled
@command_window.index = 1
else
@command_window.disable_item(1)
end
$game_system.bgm_play($data_system.title_bgm)
Audio.me_stop
Audio.bgs_stop
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@command_window.dispose
@plane.bitmap.dispose
@plane.dispose
@fog.bitmap.dispose
@fog.dispose
@title.bitmap.dispose
@title.dispose
end
def update
@plane.ox += PLANE_OX
@plane.oy += PLANE_OY
@fog.ox += FOG_OX
@fog.oy += FOG_OY
@command_window.update
if Input.trigger?(Input::C)
case @command_window.index
when 0
command_new_game
when 1
command_continue
when 2
command_shutdown
end
end
end
def command_new_game
$game_system.se_play($data_system.decision_se)
Audio.bgm_stop
Graphics.frame_count = 0
$game_temp = Game_Temp.new
$game_system = Game_System.new
$game_switches = Game_Switches.new
$game_variables = Game_Variables.new
$game_self_switches = Game_SelfSwitches.new
$game_screen = Game_Screen.new
$game_actors = Game_Actors.new
$game_party = Game_Party.new
$game_troop = Game_Troop.new
$game_map = Game_Map.new
$game_player = Game_Player.new
$game_party.setup_starting_members
$game_map.setup($data_system.start_map_id)
$game_player.moveto($data_system.start_x, $data_system.start_y)
$game_player.refresh
$game_map.autoplay
$game_map.update
$scene = Scene_Map.new
end
def command_continue
unless @continue_enabled
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$scene = Scene_Load.new
end
def command_shutdown
$game_system.se_play($data_system.decision_se)
Audio.bgm_fade(800)
Audio.bgs_fade(800)
Audio.me_fade(800)
$scene = nil
end
def battle_test
$data_actors = load_data("Data/BT_Actors.rxdata")
$data_classes = load_data("Data/BT_Classes.rxdata")
$data_skills = load_data("Data/BT_Skills.rxdata")
$data_items = load_data("Data/BT_Items.rxdata")
$data_weapons = load_data("Data/BT_Weapons.rxdata")
$data_armors = load_data("Data/BT_Armors.rxdata")
$data_enemies = load_data("Data/BT_Enemies.rxdata")
$data_troops = load_data("Data/BT_Troops.rxdata")
$data_states = load_data("Data/BT_States.rxdata")
$data_animations = load_data("Data/BT_Animations.rxdata")
$data_tilesets = load_data("Data/BT_Tilesets.rxdata")
$data_common_events = load_data("Data/BT_CommonEvents.rxdata")
$data_system = load_data("Data/BT_System.rxdata")
Graphics.frame_count = 0
$game_temp = Game_Temp.new
$game_system = Game_System.new
$game_switches = Game_Switches.new
$game_variables = Game_Variables.new
$game_self_switches = Game_SelfSwitches.new
$game_screen = Game_Screen.new
$game_actors = Game_Actors.new
$game_party = Game_Party.new
$game_troop = Game_Troop.new
$game_map = Game_Map.new
$game_player = Game_Player.new
$game_party.setup_battle_test_members
$game_temp.battle_troop_id = $data_system.test_troop_id
$game_temp.battle_can_escape = true
$game_map.battleback_name = $data_system.battleback_name
$game_system.se_play($data_system.battle_start_se)
$game_system.bgm_play($game_system.battle_bgm)
$scene = Scene_Battle.new
end
end