0 votes

I'm making a simple and miniscule 2D top-down game just so I can get the hang of things.

How would I be able to make a door that transports a player from an overworld into and interior once interacted with? One of those classic "fade to black" kind of doors that play a short animation before teleporting the player would be just fine. Something like this:

https://imgur.com/a/HBMPlsY

I think I already know how to make the animation for the door to play after the player interacts with it, but I have no idea on how to make everything before and after it happen.

I know that this is a simple question that even a toddler would know the answer, but I would be grateful if someone were to teach me how to proceed.

Godot version v3.3.4
in Engine by (12 points)
edited by

1 Answer

0 votes

You would need something to trigger the fade, so either have an area2d or a collision box around the door so you know when the player has stepped there.

In that scene you then need a canvaslayer and create a sprite as a sub node which will just be a black box. The create an animation player on that sprite with the alpha set to full at the start and then off at the end. Then when you detect the player going into the area2d of the door you can play the animation and a black box will fade in to the scene blocking everything else beneath it. After that you can just transition to the next scene where you want the player to be or move the player to a position node if it is in the same scene. If you then do the same animation in reverse you can fade back in if you want. Hope this helps.

by (1,351 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.