Topic was automatically imported from the old Question2Answer platform.
Asked By
haha-lolcat1
Hi all,
I’m still relatively new to Godot and I have a problem.
I’m trying to set up a scene change through a node called “portal”.
Basically the idea is to start a FadeOut( or blackout) animation, wait until the animation is done, change the scene, and then begin Fading In.
However, the problem that I’m facing is that FadeOut, yield and change_scene work, but the FadeIn animation doesn’t.
what could the problem be?
If you don’t know how to use Autoloads yet then just put the fade-in into the scene you are changing to. Try putting it under the ready function so it will be called as soon as the scene is loaded.
Yeah I’m still new to autoloads, and it looks like my assumption of a simple functionality (pause → fade out → wait (yield) for fade out → change scene → fade in → wait for fade in → unpause) is not that simple.
I tried using one autoloaded scene, which combined the change scene and fadeout/in animations, and also tried use two different scenes: one for changing scenes on body enters, the other for fading animations.
So far, no luck.
I’m looking at different tutorials to use a different method for this. I really want to find the simplest way. Because simple things require simple resolutions in the future.
haha-lolcat1 | 2021-07-09 18:02
Yes, I agree, finding a simple way would be best. Not sure if you still haven’t solved the problem but here is how I did fading for an rpg. With just a few lines of code inside an autoload scene.
func fadein():
$AnimationPlayer.play("fade")
func fadeout():
$AnimationPlayer.play("fadeout")
yield(get_tree().create_timer(0.3), "timeout")
# The method scene is the path to the Scene I want to change to
func SceneChanger(Scene):
fadein()
get_tree().change_scene(Scene)
fadeout()
And the tree is
CanvasLayer
- Animationplayer
- ColorRect
Asthmar | 2021-07-11 06:25
hi Asthmar,
thanks for the help, I figured it out a few days ago, finally!
I had to create a “portal” scene and a “transition” scene-autoload.
it seems that I’ve been missing two key things that resolved my problem:
a yield timer(which you mentioned) and a custom signal within the portal godot code.