Screen transition

Godot Version

4

Question

Hi

I am trying to think up a way to do a screen transition but I fear that what comes to mind is too messy and impractical.

The transition is for a simple visual novel, just to practice using the engine. I’m a beginner and thought I should just keep it simple. The transition doesn’t have to be perfect or anything, just not a complete train wreck like I imagine the method below to be.

Could anyone share some thoughts? Would be very appreciated.

Idea:
A sprite2d node is present in the scene. Starting set to full opacity, just a black rectangle
When scene about to change, sprite2d decreases opacity, so a black rectangle fades in.
Scene changes
Black rectangle fading out, then remains in background until called to fade in.

I guess this would be a mess?

The start should be easy. Just have some prompt on _ready to call for a increase in opacity over say 1 second? But the decrease in opacity would not have time to happen. It would happen at the same time as a new scene is opened, so it would need a timer of some sort to work.

How would you set up a scene transition? Just fade to black, back to clear. Nothing fancy.

A simple solution would be using an animation player on the alpha property. You could then use await $AnimationPlayer.animation_finished, for example

func do_fade_out() -> void:
	# start the fade animation
	$AnimationPlayer.play("fade")
	
	# wait for the animation to finish before continuing
	await $AnimationPlayer.animation_finished
	
	# do the next thing

1 Like

I did a fade to dark gray using a ColorRect and AnimationPlayer - starts at full transparency and ends at full opacity. Apologies for the formatting and bad humour.

@onready var SceneTranAnim = $death_fade/AnimationPlayer

print("!!YOU DEAD FROM ALPACA!!")
SceneTranAnim.play("death_fade")
await get_tree().create_timer(2).timeout
self.queue_free()
get_tree().change_scene_to_file("res://scenes/dead_from_alpaca.tscn")
	
1 Like

Thanks, both
I decided to use the animation player as well! Turned out quite well!

I’m looking forward to seeing what you’re working on. :smile:

1 Like

Well, its a little horror story. A friend of mine is a good painter and we wanted to create something together now that I’m trying to learn how to use godot. Thing is, my coding and engine skills are very limiting so we have to go for a very simple visual novel kind of game, so that she can paint and I can write a story and struggle with the most basic things the engine has on offer. We have as a goal to finish it within two months! If you are curious, I’ll remember to drop you a link!

1 Like

Keep learning - I’ve been learning Godot for about 3 months and learnt a lot during that time. :smile:

When it’s ready or even when it’s got some playable components, put a html version on itch.io (or similar) and I’ll be happy to provide suggestions. :smile:

I’ve got most of my tech demos on itch.io

Good idea, I’ll do that! But first, need to try to figure out how to get the fade effect on a richtextlabel to work.

Drop me a link to one of your projects if you have one you want to share!

1 Like

A fade effect on a textlabel sounds nice. I just clear them after a few seconds.

My public demos are here

That’s nice. I like the idea of trying stuff out and uploading. Doesn’t have to be perfect. I have seen mentions of a tutorial hell that some people end up in, not experimenting making their own games but just following along to videos!
I’ll get inspired and start uploading a bit as well as i make progress.
Cheers!

1 Like

I mostly upload to YouTube and itch.io so my friends can provide feedback/suggestions. No need to wait until perfection for that. :smile: