#==================================================
# Scene_Title
#==================================================
MAPID = 1
X_Start = 2
Y_Start = 14
class Scene_Title
#--------------------------------------------------------------------------
# Defines the main processing of the Title Scene.
#--------------------------------------------------------------------------
def main
# Checks if you're executing a Battle Test.
if $BTEST
battle_test
return
end
# Load Data
$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")
# Create
$game_system = Game_System.new
# Title Graphic
@sprite = Sprite.new
@sprite.bitmap = RPG::Cache.title($data_system.title_name)
# Commands
s1 = "Start New Game"
s2 = "Continue"
s3 = "Tutorial"
s4 = "Exit"
@command_window = Window_Command.new(192, [s1, s2, s3, s4])
@command_window.back_opacity = 160
@command_window.x = 320 - @command_window.width / 2
@command_window.y = 288
# Disables continue.
@continue_enabled = false
# Checks for savefiles.
for i in 0..3
if FileTest.exist?("Save#{i+1}.sav")
# If there's a savefile, there's a continue.
@continue_enabled = true
end
end
# Checks if continue is enabled, else disable the command.
if @continue_enabled
@command_window.index = 1
else
@command_window.disable_item(1)
end
# BGM play
$game_system.bgm_play($data_system.title_bgm)
# BGS & ME stop
Audio.me_stop
Audio.bgs_stop
# Graphic
Graphics.transition
# Create Loop
loop do
# Graphics update
Graphics.update
# Key pressing update
Input.update
# update
update
if $scene != self
# Break loop
break
end
end
# Graphics freeze
Graphics.freeze
# Disposing the command window.
@command_window.dispose
# Disposing the title graphic.
@sprite.bitmap.dispose
@sprite.dispose
end
#--------------------------------------------------------------------------
# Update the command window.
#--------------------------------------------------------------------------
def update
# Command window update
@command_window.update
# Input update
if Input.trigger?(Input::C)
# Command window index
case @command_window.index
when 0
command_new_game
when 1
command_continue
when 2
command_tutorial
when 3
command_shutdown
end
end
end
#--------------------------------------------------------------------------
# This part defines the action that's executed when the player selects a new game.
#--------------------------------------------------------------------------
def command_new_game
# SE play
$game_system.se_play($data_system.decision_se)
# BGM stop
Audio.bgm_stop
# Graphic
Graphics.frame_count = 0
# Create data
$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
# Starting Party Members
$game_party.setup_starting_members
# Start Map ID
$game_map.setup($data_system.start_map_id)
# Teleport player to starting location
$game_player.moveto($data_system.start_x, $data_system.start_y)
# Player refresh
$game_player.refresh
# Map Audio play
$game_map.autoplay
# Update
$game_map.update
# New Scene
$scene = Scene_Map.new
end
#--------------------------------------------------------------------------
# This part defines the action that's executed when the player selects continue.
#--------------------------------------------------------------------------
def command_continue
# Checks if continue is disabled
unless @continue_enabled
# SE play
$game_system.se_play($data_system.buzzer_se)
return
end
# SE play
$game_system.se_play($data_system.decision_se)
# New Scene
$scene = Scene_Load.new
end
#--------------------------------------------------------------------------
# This part defines the action that's executed when the player selects the tutorial.
#--------------------------------------------------------------------------
def command_tutorial
# SE play
$game_system.se_play($data_system.decision_se)
# BGM stop
Audio.bgm_stop
# Graphic
Graphics.frame_count = 0
# Create data
$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
# Starting Party Members
$game_party.setup_starting_members
# Start Map ID
$game_map.setup($data_system.start_map_id = MAPID)
# Teleport player to starting location
$game_player.moveto($data_system.start_x = X_Start, $data_system.start_y = Y_Start)
# Player refresh
$game_player.refresh
# Map Audio
$game_map.autoplay
# Map Update
$game_map.update
# New Scene
$scene = Scene_Map.new
end
#--------------------------------------------------------------------------
# This part defines the action that's executed when the player selects shutdown.
#--------------------------------------------------------------------------
def command_shutdown
# SE play
$game_system.se_play($data_system.decision_se)
# Audio fading
Audio.bgm_fade(800)
Audio.bgs_fade(800)
Audio.me_fade(800)
# New Scene
$scene = nil
end
#--------------------------------------------------------------------------
# This part will execute the Battle Test if you'll do a battle test from the database.
#--------------------------------------------------------------------------
def battle_test
# Load Data
$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")
# Graphic
Graphics.frame_count = 0
# Create data
$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
# Setup
$game_party.setup_battle_test_members
# Get information.
$game_temp.battle_troop_id = $data_system.test_troop_id
$game_temp.battle_can_escape = true
$game_map.battleback_name = $data_system.battleback_name
# SE play
$game_system.se_play($data_system.battle_start_se)
# BGM play
$game_system.bgm_play($game_system.battle_bgm)
# New Scene
$scene = Scene_Battle.new
end
end