09-19-2005, 01:00 PM
This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.
No support is given. If you are the owner of the thread, please contact administration.
Another Advanced title screen...
This time, it does not use any cursor...But it changes picture when you the command is highlited.
Thank you very much to Magic Magor for showing me how to do it.
The Script:
Replace scene_title with this:
Code:
#==============================================================================
# ■ Scene_Title
#------------------------------------------------------------------------------
# タイトル画面の処理を行うクラスです。
#==============================================================================
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
# タイトルグラフィックを作成
@sprite = Sprite.new
@sprite.bitmap = RPG::Cache.title($data_system.title_name)
# コマンドウィンドウを作成
s1 = ""
s2 = ""
s3 = ""
@command_window = Window_Command2.new(192, [s1, s2, s3])
@command_window.back_opacity = 160
@command_window.x = 320 - @command_window.width / 2
@command_window.y = 288
@newgame =Sprite.new
@newgame.bitmap =RPG::Cache.title("newgame")
@newgame.y = 80
@newgame.x = 240
@newgame.z = 9999
@newgame.visible =false
@newgame2 =Sprite.new
@newgame2.bitmap =RPG::Cache.title("newgame2")
@newgame2.y = 80
@newgame2.x = 240
@newgame2.z = 9999
@newgame2.visible =true
@continue =Sprite.new
@continue.bitmap =RPG::Cache.title("continue")
@continue.y = 180
@continue.x = 240
@continue.z = 9999
@continue.visible =false
@continue2 =Sprite.new
@continue2.bitmap =RPG::Cache.title("continue2")
@continue2.y = 180
@continue2.x = 240
@continue2.z = 9999
@continue2.visible =true
@endgame =Sprite.new
@endgame.bitmap =RPG::Cache.title("endgame")
@endgame.y = 280
@endgame.x = 240
@endgame.z = 9999
@endgame.visible =false
@endgame2 =Sprite.new
@endgame2.bitmap =RPG::Cache.title("endgame2")
@endgame2.y = 280
@endgame2.x = 240
@endgame2.z = 9999
@endgame2.visible =true
@continue_enabled = false
dispose = [@command_window, @newgame, @newgame2, @continue, @continue2, @endgame, @endgame2, @sprite]
for i in 0..3
if FileTest.exist?("Save#{i+1}.sav")
@continue_enabled = true
end
end
# コンティニューが有効な場合、カーソルをコンティニューに合わせる
# 無効な場合、コンティニューの文字をグレー表示にする
if @continue_enabled
@command_window.index = 1
else
@command_window.disable_item(1)
end
# タイトル BGM を演奏
$game_system.bgm_play($data_system.title_bgm)
# ME、BGS の演奏を停止
Audio.me_stop
Audio.bgs_stop
# トランジション実行
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
dispose.each {|x| x.dispose if !x.disposed?}# <- Here's the Key
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
if (@command_window.index== 0)
@newgame.visible =false
@newgame2.visible =true
else
@newgame.visible =true
@newgame2.visible =false
end
if (@command_window.index == 1)
@continue2.visible =true
@continue.visible =false
else
@continue.visible =true
@continue2.visible =false
end
if (@command_window.index == 2)
@endgame.visible =false
@endgame2.visible =true
else
@endgame2.visible =false
@endgame.visible =true
end
# And so on..
# コマンドウィンドウを更新
@command_window.update
# C ボタンが押された場合
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
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
# BGM を停止
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
# マップに設定されている BGM と BGS の自動切り替えを実行
$game_map.autoplay
# マップを更新 (並列イベント実行)
$game_map.update
# マップ画面に切り替え
$scene = Scene_Map.new
end
#--------------------------------------------------------------------------
# ● コマンド : コンティニュー
#--------------------------------------------------------------------------
def command_continue
# コンティニューが無効の場合
unless @continue_enabled
# ブザー SE を演奏
$game_system.se_play($data_system.buzzer_se)
return
end
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
# ロード画面に切り替え
$scene = Scene_Load.new
end
#--------------------------------------------------------------------------
# ● コマンド : シャットダウン
#--------------------------------------------------------------------------
def command_shutdown
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
# BGM、BGS、ME をフェードアウト
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
# トループ ID、逃走可能フラグ、バトルバックを設定
$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 を演奏
$game_system.se_play($data_system.battle_start_se)
# バトル BGM を演奏
$game_system.bgm_play($game_system.battle_bgm)
# バトル画面に切り替え
$scene = Scene_Battle.new
end
end
Make a new script under window_command:
Code:
#==============================================================================
# ■ Window_Command
#------------------------------------------------------------------------------
# 一般的なコマンド選択を行うウィンドウです。
#==============================================================================
class Window_Command2 < Window_Selectable
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# width : ウィンドウの幅
# commands : コマンド文字列の配列
#--------------------------------------------------------------------------
def initialize(width, commands)
# コマンドの個数からウィンドウの高さを算出
super(0, 0, width, commands.size * 32 + 32)
@item_max = commands.size
@commands = commands
self.contents = Bitmap.new(width - 32, @item_max * 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
self.windowskin=nil
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i, normal_color)
end
end
#--------------------------------------------------------------------------
# ● 項目の描画
# index : 項目番号
# color : 文字色
#--------------------------------------------------------------------------
def draw_item(index, color)
self.contents.font.color = color
rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index])
end
#--------------------------------------------------------------------------
# ● 項目の無効化
# index : 項目番号
#--------------------------------------------------------------------------
def disable_item(index)
draw_item(index, disabled_color)
end
end
No screenies...As it is hard to show..
Credits:
This is pretty basic...Credits is optional...
Note:
The graphics are eijin's...Ask him before using!