From 5bb407be9655f15932d0eb7cfe0fdbe84746c79e Mon Sep 17 00:00:00 2001 From: Mathew Velasquez Date: Thu, 25 Feb 2016 19:46:34 -0500 Subject: [PATCH] Fade to black transition for travel --- scripts/FastTravel.rb | 22 ++++++++++++++-------- scripts/Scene_Map.rb | 13 +++++++++++++ 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/scripts/FastTravel.rb b/scripts/FastTravel.rb index b145d95..399fe3a 100644 --- a/scripts/FastTravel.rb +++ b/scripts/FastTravel.rb @@ -22,6 +22,8 @@ class FastTravel @index = 0 @fade_in = false @fade_out = false + + @transfer_player = nil end def dispose @@ -94,6 +96,17 @@ class FastTravel spr.dispose end @data_sprites = [] + + if @transfer_player + $game_temp.player_transferring = true + $game_temp.player_new_map_id = @transfer_player.id + $game_temp.player_new_x = @transfer_player.x + $game_temp.player_new_y = @transfer_player.y + $game_temp.player_new_direction = @transfer_player.dir + Graphics.freeze + $game_temp.transition_processing = true + $game_temp.transition_name = "black" + end end return end @@ -131,14 +144,7 @@ class FastTravel $game_system.se_play($data_system.decision_se) choice = $game_fasttravel.unlocked_maps[@data[@index]] if choice.id != $game_map.map_id - $game_temp.player_transferring = true - $game_temp.player_new_map_id = choice.id - $game_temp.player_new_x = choice.x - $game_temp.player_new_y = choice.y - $game_temp.player_new_direction = choice.dir - Graphics.freeze - $game_temp.transition_processing = true - $game_temp.transition_name = "travel" + @transfer_player = choice end @fade_out = true return diff --git a/scripts/Scene_Map.rb b/scripts/Scene_Map.rb index 36cae24..8f58552 100644 --- a/scripts/Scene_Map.rb +++ b/scripts/Scene_Map.rb @@ -28,6 +28,12 @@ class Scene_Map @item_id = 0 # Make fast travel menu @fast_travel = FastTravel.new + # Fade to black transition + @blackfade = Sprite.new + @blackfade.bitmap = Bitmap.new(640, 480) + @blackfade.bitmap.fill_rect(0, 0, 640, 480, Color.new(0, 0, 0)) + @blackfade.visible = false + @blackfade.z = 9999 # Transition run Graphics.transition # Main loop @@ -56,6 +62,7 @@ class Scene_Map @fast_travel.dispose # Dispose of item icon @item_icon.dispose + @blackfade.dispose # If switching to title screen if $scene.is_a?(Scene_Title) # Fade out screen @@ -143,6 +150,12 @@ class Scene_Map # Execute transition if $game_temp.transition_name == "" Graphics.transition(20) + elsif $game_temp.transition_name == "black" + @blackfade.visible = true + Graphics.transition(30) + Graphics.freeze + @blackfade.visible = false + Graphics.transition(30) else Graphics.transition(40, "Graphics/Transitions/" + $game_temp.transition_name)