Fade to black transition for travel

This commit is contained in:
Mathew Velasquez 2016-02-25 19:46:34 -05:00
parent 49e9f81953
commit 5bb407be96
2 changed files with 27 additions and 8 deletions

View file

@ -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

View file

@ -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)