##############################################################
# Script By Johnny Mercy
# Program: Rpg Maker VX
# Language: RGSS2
##############################################################
# Class SceneTittle
##############################################################
class Scene_Title < Scene_Base
#--------------------------------------------------------------------------
# Processo principal
#--------------------------------------------------------------------------
def main
if $BTEST # Se for teste de batalha
battle_test # Teste inicia
else # Se voc? est? jogando normal
super # V? ao processo principal
end
end
#--------------------------------------------------------------------------
# Inicializa??o do processo
#--------------------------------------------------------------------------
def start
load_database # Carrega o banco de dados
create_game_objects # Cria os objetos do jogo
check_continue # Verifica se h? arquivos salvos
play_title_music # Toca a m?sica de T?tulo
#----------------------------------------------------------------------
# Configura??es
#----------------------------------------------------------------------
#Nome da Imagem de Background
@nBgImage = "FFBg"
#Nome da imagem do selector
@nSelector = "handpick"
#Nome das imagens dos explicadores
@nexp1 = "exp1"
@nexp2 = "exp2"
@nexp3 = "exp3"
#Nome das imagens do menu do t?tulo
@nnew_game = "new_game"
@ncontinue = "continue"
@nexit = "exit"
#----------------------------------------------------------------------
# Fim das Configura??es
#----------------------------------------------------------------------
@SelectorStartPos = 112
@handmov = "left"
@menu_index = 0
load_images()
end
#--------------------------------------------------------------------------
# Atualiza??o da tela
#--------------------------------------------------------------------------
def update
current_menu_index()
selector_animation()
keyboard_input()
end
#--------------------------------------------------------------------------
# Fim do processo
#--------------------------------------------------------------------------
def terminate
@bg.dispose
@new_game.dispose
@continue.dispose
@exit.dispose
@exp1.dispose
@exp2.dispose
@exp3.dispose
@selector.dispose
end
def keyboard_input
if Input.trigger?(Input::DOWN) and @menu_index < 2
@menu_index += 1
Sound.play_cursor
elsif Input.trigger?(Input::DOWN) and @menu_index == 2
@menu_index = 0
Sound.play_cursor
elsif Input.trigger?(Input::UP) and @menu_index > 0
@menu_index -= 1
Sound.play_cursor
elsif Input.trigger?(Input::UP) and @menu_index == 0
@menu_index = 2
Sound.play_cursor
end
if Input.trigger?(Input::C)
case @menu_index
when 0
command_new_game
when 1
command_continue
when 2
command_shutdown
end
end
end
#--------------------------------------------------------------------------
# Actualiza??es do Menu
#--------------------------------------------------------------------------
def current_menu_index
case @menu_index
when 0
menu_opacity(255,160,160)
exp_opacity(255,0,0)
when 1
menu_opacity(160,255,160)
exp_opacity(0,255,0)
when 2
menu_opacity(160,160,255)
exp_opacity(0,0,255)
end
@selector.y = 252 + (20 * @menu_index)
end
#--------------------------------------------------------------------------
# Opacidade dos items do Menu
#--------------------------------------------------------------------------
def menu_opacity(a,b,c)
@new_game.opacity = a
@continue.opacity = b
@exit.opacity = c
@new_game.update
@continue.update
@exit.update
end
#--------------------------------------------------------------------------
# Opacidade das explica??es
#--------------------------------------------------------------------------
def exp_opacity(a,b,c)
@exp1.opacity = a
@exp2.opacity = b
@exp3.opacity = c
@exp1.update
@exp2.update
@exp3.update
end
#--------------------------------------------------------------------------
# Anima??o do Selector
#--------------------------------------------------------------------------
def selector_animation
if (@handmov == "left" and @selector.x > (@SelectorStartPos - 10))
@selector.x -= 1
elsif (@handmov == "left" and @selector.x <= (@SelectorStartPos - 10))
@selector.x = @SelectorStartPos - 10
@handmov = "right"
end
if (@handmov == "right" and @selector.x < @SelectorStartPos)
@selector.x += 1
elsif (@handmov == "right" and @selector.x >= @SelectorStartPos)
@selector.x = @SelectorStartPos
@handmov = "left"
end
@selector.update
end
#--------------------------------------------------------------------------
# Carregamento de Imagens usadas no t?tulo
#--------------------------------------------------------------------------
def load_images
#Background
@bg = Sprite.new
@bg.bitmap = Cache.picture(@nBgImage)
#Menu
@new_game = Sprite.new
@new_game.bitmap = Cache.picture(@nnew_game)
@new_game.x = 149
@new_game.y = 253
@continue = Sprite.new
@continue.bitmap = Cache.picture(@ncontinue)
@continue.x = 149
@continue.y = 253 + 20
@exit = Sprite.new
@exit.bitmap = Cache.picture(@nexit)
@exit.x = 149
@exit.y = 253 + 40
#Explica??es
@exp1 = Sprite.new
@exp1.bitmap = Cache.picture(@nexp1)
@exp1.x = 285
@exp1.y = 262
@exp2 = Sprite.new
@exp2.bitmap = Cache.picture(@nexp2)
@exp2.x = @exp1.x
@exp2.y = @exp1.y
@exp3 = Sprite.new
@exp3.bitmap = Cache.picture(@nexp3)
@exp3.x = @exp1.x
@exp3.y = @exp1.y
#Selector
@selector = Sprite.new
@selector.bitmap = Cache.picture(@nSelector)
@selector.x = @SelectorStartPos
@selector.y = 252
end
#--------------------------------------------------------------------------
# Carregamento do banco de dados
#--------------------------------------------------------------------------
def load_database
$data_actors = load_data("Data/Actors.rvdata")
$data_classes = load_data("Data/Classes.rvdata")
$data_skills = load_data("Data/Skills.rvdata")
$data_items = load_data("Data/Items.rvdata")
$data_weapons = load_data("Data/Weapons.rvdata")
$data_armors = load_data("Data/Armors.rvdata")
$data_enemies = load_data("Data/Enemies.rvdata")
$data_troops = load_data("Data/Troops.rvdata")
$data_states = load_data("Data/States.rvdata")
$data_animations = load_data("Data/Animations.rvdata")
$data_common_events = load_data("Data/CommonEvents.rvdata")
$data_system = load_data("Data/System.rvdata")
$data_areas = load_data("Data/Areas.rvdata")
end
#--------------------------------------------------------------------------
# Carregamento do banco de dados para teste de batalha
#--------------------------------------------------------------------------
def load_bt_database
$data_actors = load_data("Data/BT_Actors.rvdata")
$data_classes = load_data("Data/BT_Classes.rvdata")
$data_skills = load_data("Data/BT_Skills.rvdata")
$data_items = load_data("Data/BT_Items.rvdata")
$data_weapons = load_data("Data/BT_Weapons.rvdata")
$data_armors = load_data("Data/BT_Armors.rvdata")
$data_enemies = load_data("Data/BT_Enemies.rvdata")
$data_troops = load_data("Data/BT_Troops.rvdata")
$data_states = load_data("Data/BT_States.rvdata")
$data_animations = load_data("Data/BT_Animations.rvdata")
$data_common_events = load_data("Data/BT_CommonEvents.rvdata")
$data_system = load_data("Data/BT_System.rvdata")
end
#--------------------------------------------------------------------------
# Cria??o dos objetos do jogo
#--------------------------------------------------------------------------
def create_game_objects
$game_temp = Game_Temp.new
$game_message = Game_Message.new
$game_system = Game_System.new
$game_switches = Game_Switches.new
$game_variables = Game_Variables.new
$game_self_switches = Game_SelfSwitches.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
end
#--------------------------------------------------------------------------
# Verifica se h? arquivos salvos
#--------------------------------------------------------------------------
def check_continue
@continue_enabled = (Dir.glob('Save*.rvdata').size > 0)
end
#--------------------------------------------------------------------------
# Verifica se h? uma Posi??o Inicial de Personagem
#--------------------------------------------------------------------------
def confirm_player_location
if $data_system.start_map_id == 0
print "A Posi??o Inicial de Personagem n?o foi definida."
exit
end
end
#--------------------------------------------------------------------------
# Comando: Novo Jogo
#--------------------------------------------------------------------------
def command_new_game
confirm_player_location
Sound.play_decision
$game_party.setup_starting_members # A equipe (party) inicial
$game_map.setup($data_system.start_map_id) # Posi??o inicial no mapa
$game_player.moveto($data_system.start_x, $data_system.start_y)
$game_player.refresh
$scene = Scene_Map.new
RPG::BGM.fade(1500)
Graphics.fadeout(60)
Graphics.wait(40)
Graphics.frame_count = 0
RPG::BGM.stop
$game_map.autoplay
end
#--------------------------------------------------------------------------
# Comando: Continuar
#--------------------------------------------------------------------------
def command_continue
if @continue_enabled
Sound.play_decision
$scene = Scene_File.new(false, true, false)
else
Sound.play_buzzer
end
end
#--------------------------------------------------------------------------
# Comando: Sair
#--------------------------------------------------------------------------
def command_shutdown
Sound.play_decision
RPG::BGM.fade(800)
RPG::BGS.fade(800)
RPG::ME.fade(800)
$scene = nil
end
#--------------------------------------------------------------------------
# Toca a m?sica de t?tulo
#--------------------------------------------------------------------------
def play_title_music
$data_system.title_bgm.play
RPG::BGS.stop
RPG::ME.stop
end
#--------------------------------------------------------------------------
# Teste de batalha
#--------------------------------------------------------------------------
def battle_test
load_bt_database # Carrega o banco de dados para o teste
create_game_objects # Cria os objetos do jogo
Graphics.frame_count = 0 # Inicializa??o da contagem de frames
$game_party.setup_battle_test_members
$game_troop.setup($data_system.test_troop_id)
$game_troop.can_escape = true
$game_system.battle_bgm.play
snapshot_for_background
$scene = Scene_Battle.new
end
end