#============================================================================== # ■ VX-RGSS2-24 エンディング [Ver.1.0.0] by Claimh #------------------------------------------------------------------------------ # エンディング(スタッフロール)の雛型です # あくまで雛形なので、自分で納得がいくように改造してください。 # # 表示順:製作者等表示 → 〜Fin〜表示 # (→クリアデータをセーブ)→ タイトルor強制終了 # # 画像パス:Graphics/Pictures #------------------------------------------------------------------------------ #【呼び出し】 # SceneManager.goto(Scene_Ending) #============================================================================== #============================================================================== # □ カスタマイズ 〜START〜 #============================================================================== module Ending # エンディング後はタイトルに戻す(false:強制終了) BACKTO_TITLE = true # クリアデータセーブを行う? CLRED_SAVE = false # クリアデータ上でONにするスイッチ CLRED_SWITCH = 10 # ボタン押下時にエンディングスキップ ON_SKIP = true # 画像表示位置 # 0 : 画像いっぱい # 1 : 特定位置へ表示 # 2 : 特定矩形へ表示 G_TYPE = 1 # 画像表示位置 [x, y] G_POS = [10, 100] # 画像表示矩形 G_RECT = Rect.new(10, 100, 200, 200) # シーン番号ごとの切り替え間隔(frame数) SC_WAIT = 60 * 3 # シーン切り替え演出 # 0 : 演出なし # 1 : トランジション(フェード)を挟む SC_EFFECT = 1 # 〜FIN〜表示位置 [x, y] FIN_POS = [Graphics.width - 150, Graphics.height - 50] # 〜FIN〜時のウェイト(nil:ボタンが押されるまでウェイト) FIN_WAIT = 60 * 5 end #============================================================================== # ■ シーン制御設定 #============================================================================== class Scene_Ending < Scene_Base include Ending #-------------------------------------------------------------------------- # ● エンドミュージック # n : シーン番号 #-------------------------------------------------------------------------- def end_music(n=0) case n when 0 # 最初のBGM return RPG::BGM.new("Theme3") when -1 # Fin時のBGM return RPG::BGM.new("Scene5", 80, 80) end return nil end #-------------------------------------------------------------------------- # ● エンド背景 # n : シーン番号 (-1:Fin画像) #-------------------------------------------------------------------------- def end_graphic(n=0) case n when 0 # 最初の画像 return Cache.picture("Mountains5") when -1 # Fin画像 return Cache.picture("Fin") when -2 # Fin画像2 return Cache.picture("StarlitSky") #~ when 3 # (例) 途中で画像をチェンジ #~ return Cache.picture("Ocean1") end return nil end #-------------------------------------------------------------------------- # ★ エンディングロール処理 # n : シーン番号 #-------------------------------------------------------------------------- TEXTS = [ # ["役割", "名前", "付属情報", …] ["シナリオ", "アレックス"], ["グラフィック", "アルシェス"], ["音楽", "\\n[1]", "\\n[1]の隠れ家", "http://XXXXXX"], ["プログラム", "\\n[3]", "The \\n[3]", "http://YYYYY"], ["スペシャルサンクス", "\\n[5]", "\\n[6]", "\\n[7]", "\\n[8]"] ] def update_ending(n) play_music(n) # BGM演奏 redraw_end_graphic(n) # 画像描画 draw_text(250, 100, TEXTS[n]) # テキスト描画 end #-------------------------------------------------------------------------- # ● Fin表示 #-------------------------------------------------------------------------- def finish play_music(-1) clear_graphic #~ draw_graphic(end_graphic_rect(-2, 0), -2) # 背景 draw_graphic(end_graphic_rect(-1, 1, FIN_POS[0], FIN_POS[1]), -1) end end #============================================================================== # □ カスタマイズ 〜END〜 #============================================================================== #============================================================================== # ■ 汎用メソッド ★部分で使用する #============================================================================== class Scene_Ending < Scene_Base #-------------------------------------------------------------------------- # ● ミュージック演奏 # n : シーン番号 #-------------------------------------------------------------------------- def play_music(n=0) music = end_music(n) return if music.nil? music.play end #-------------------------------------------------------------------------- # ● エンド背景の描画先矩形 # n : シーン番号 #-------------------------------------------------------------------------- def end_graphic_rect(n=0, type=G_TYPE, x=G_POS[0], y=G_POS[1]) case type when 0 # 画面いっぱいに描画 return @viewport.rect when 1 # アスペクト比を維持して特定位置に描画 return Rect.new(x, y, end_graphic(n).width, end_graphic(n).height) when 2 # 特定矩形に収まるように描画 return G_RECT end end #-------------------------------------------------------------------------- # ● 画像描画 # rect : 描画先矩形 # n : シーン番号 #-------------------------------------------------------------------------- def draw_graphic(rect, n=0) graphic = end_graphic(n) src_rect = Rect.new src_rect.width = graphic.width src_rect.height = graphic.height @sprite.bitmap.stretch_blt(rect, graphic, src_rect) end #-------------------------------------------------------------------------- # ● 画像領域消去 # rect : 消去矩形 #-------------------------------------------------------------------------- def clear_graphic(rect=@viewport.rect) @sprite.bitmap.clear_rect(rect) end #-------------------------------------------------------------------------- # ● シーン番号別 画像描画 #-------------------------------------------------------------------------- def draw_end_graphic(n=0, type=G_TYPE) draw_graphic(end_graphic_rect(n, type), n) end #-------------------------------------------------------------------------- # ● シーン番号別 画像再描画 #-------------------------------------------------------------------------- def redraw_end_graphic(n=0, type=G_TYPE) return if end_graphic(n).nil? clear_graphic draw_end_graphic(n, type) end #-------------------------------------------------------------------------- # ● テキスト描画 #-------------------------------------------------------------------------- def draw_text(x, y, texts) texts.size.times do |i| xx = (i == 0) ? x : (x+30) @window.draw_text_ex(xx, y, texts[i]) y += @window.line_height end end #-------------------------------------------------------------------------- # ● テキスト消去 #-------------------------------------------------------------------------- def clear_text @window.contents.clear end end #============================================================================== # ■ シーンクラス #============================================================================== class Scene_Ending < Scene_Base #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize super @no = 0 @called_save = false end #-------------------------------------------------------------------------- # ● 開始処理 #-------------------------------------------------------------------------- def start super create_viewport create_sprite create_window return goto_next_scene if @no >= TEXTS.size update_ending(@no) end #-------------------------------------------------------------------------- # ● 画面Viewport生成 #-------------------------------------------------------------------------- def create_viewport @viewport = Viewport.new end #-------------------------------------------------------------------------- # ● 画像表示用スプライト生成 #-------------------------------------------------------------------------- def create_sprite @sprite = Sprite_Base.new(@viewport) @sprite.bitmap = Bitmap.new(@viewport.rect.width, @viewport.rect.height) end #-------------------------------------------------------------------------- # ● 文字描画用ウィンドウ生成 #-------------------------------------------------------------------------- def create_window r = @viewport.rect @window = Window_Base.new(r.x, r.y, r.width, r.width) @window.opacity = 0 end #-------------------------------------------------------------------------- # ● 終了処理 #-------------------------------------------------------------------------- def terminate dispose_sprite dispose_viewport super end #-------------------------------------------------------------------------- # ● 画面Viewport解放 #-------------------------------------------------------------------------- def dispose_viewport @viewport.dispose end #-------------------------------------------------------------------------- # ● 画像表示用スプライト解放 #-------------------------------------------------------------------------- def dispose_sprite @sprite.dispose end #-------------------------------------------------------------------------- # ● 次のシーンへ #-------------------------------------------------------------------------- def goto_next_scene if CLRED_SAVE and !@called_save call_save elsif BACKTO_TITLE SceneManager.goto(Scene_Title) else fadeout_all SceneManager.exit end end #-------------------------------------------------------------------------- # ● クリアデータをセーブ #-------------------------------------------------------------------------- def call_save $game_switches[CLRED_SWITCH] = true @called_save = true SceneManager.call(Scene_Save) end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update super update_ending_scene end #-------------------------------------------------------------------------- # ● フレーム更新 <シーン切り替え制御> #-------------------------------------------------------------------------- def update_ending_scene return goto_next_scene if @no >= TEXTS.size update_ending(@no) perform_transition if SC_EFFECT == 1 wait Graphics.freeze if SC_EFFECT == 1 clear_text @no += 1 if @no >= TEXTS.size RPG::BGM.fade(transition_speed * 2) if finish Graphics.transition(transition_speed * 2) if SC_EFFECT == 1 finish_wait end end #-------------------------------------------------------------------------- # ● トランジション速度の取得 #-------------------------------------------------------------------------- def transition_speed return 30 end #-------------------------------------------------------------------------- # ● トランジション速度の取得 #-------------------------------------------------------------------------- def skip_trigger? Input.trigger?(:C) or Input.trigger?(:B) end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update_skipwait(skip=true) update_basic skip and skip_trigger? end #-------------------------------------------------------------------------- # ● ウェイト #-------------------------------------------------------------------------- def wait(duration=SC_WAIT) duration.times { |i| break if update_skipwait(ON_SKIP) } end #-------------------------------------------------------------------------- # ● Finishウェイト #-------------------------------------------------------------------------- def finish_wait if FIN_WAIT.nil? loop do update_skipwait end else wait(FIN_WAIT) end end end