Created
February 14, 2017 18:58
-
-
Save cbscribe/d10aeb736d83f3f118d8a791f8f4a4a2 to your computer and use it in GitHub Desktop.
Scene transition - fade animation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# global - scene manager also scene with only anim and black texture | |
func change_stage(stage_path): | |
if is_changing: return | |
is_changing = true | |
get_tree().get_root().set_disable_input(true) | |
# fade to black | |
get_node("anim").play("fade_in") | |
yield(get_node("anim"), "finished") | |
# change stage | |
get_tree().change_scene(stage_path) | |
emit_signal("stage_changed") | |
# fade from black | |
get_node("anim").play("fade_out") | |
yield(get_node("anim"), "finished") | |
is_changing = false | |
get_tree().get_root().set_disable_input(false) | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment