TRANSKRIPTEnglish

Level/Scene Transition System ‣ 📖02 ‣ 📼05 ‣ Metroidvania Forge Godot 4 Tutorial Series

1h 50m 53s22,262 ord3,053 segmentsEnglish

FULLSTÄNDIGT TRANSKRIPT

0:00

In today's video, we're going to build a

0:01

nice scene transition system

0:05

along with this nice fade wipe kind of

0:07

animation. And it's all going to be

0:08

handled in one big chunky video.

0:14

Hi, my name is Michael. [music]

0:16

Join me as we build an epic Metroid

0:18

Vania game in GDO4 using GDScript.

0:20

[music]

0:23

This is the Metroid Vania Forge.

0:35

So, we've got a series of levels and we

0:37

need a way to transition between them.

0:39

So, we'll build this nice level

0:40

transition scene. This level transition

0:42

scene consists of an area 2D with a

0:44

collision shape. It's going to be

0:46

configured so that it's on a layer mask

0:47

that looks for collision just with our

0:49

player. And it's going to do things like

0:51

allow us to change the size. So here

0:53

when we set the size or the location of

0:56

this transition, it's going to update

0:59

the rendering of this level transition

1:00

in the editor. So we can see what it's

1:02

going to look like. So left, right, top

1:06

or bottom, as well as the size here,

1:09

right? So we can use this to adjust just

1:10

how big it is. So if we have those big

1:12

entrances like we've got here, we can

1:14

configure that as well. Now the script

1:15

also is going to handle when the player

1:17

enters. So we'll connect to that. But

1:20

we're you can see here I've got a nice

1:22

scene manager that we're going to

1:23

introduce a global script to our project

1:25

that's going to allow us to have signals

1:26

that dictate when things should happen

1:28

to kind of keep and help us avoid a lot

1:30

of the bugs that could arise from doing

1:32

a system like this. And then this scene

1:34

manager, whenever our player enters one

1:37

of these scenes, it's going to send this

1:39

information, you know, the direction it

1:41

is, what level they need to load next,

1:42

and which level transition they're going

1:44

to spawn at. We'll send that over to a

1:47

global script that we'll call our scene

1:48

manager. And then this sucker is going

1:50

to orchestrate the whole thing. It's

1:52

going to come in here, fire off some

1:54

signals. We're going to do things like

1:56

fade screen using a tween and a

1:59

synchronous function. And then we'll use

2:01

the get tree change scene to file to

2:03

load a new scene. And all of this is

2:05

going to kind of happen within here. And

2:07

then of course these level transitions

2:08

are going to have to hook back to that.

2:10

They'll respond to signals like when our

2:13

load scene is finished or when the new

2:14

scene is ready. Then let's go ahead and

2:16

do things like position the player or

2:19

set up this area to monitor for the

2:21

player. And we're going to build in

2:23

stuff like these physics awaits to make

2:25

sure that we don't get weird overlap as

2:27

the player transitions between scenes.

2:29

And uh it's going to be kind of handy.

2:31

So if you want to learn how this all

2:33

comes together, then stick around for

2:35

the rest of the video. Okay. So at this

2:37

point, we're going to go ahead and jump

2:38

into making this level transition. Now,

2:41

before I do, real quick, if you've been

2:42

following along, then you've already

2:44

grabbed the icons that I've got stored

2:46

here in my general icons folder. So, you

2:48

can see I've got one for my level

2:49

transition. We're going to be using that

2:50

today. So, if you want that, I mean,

2:52

it's not required. You don't have to

2:53

have it, but obviously if you do and you

2:56

haven't been following along, then you

2:57

can hop over to the H.IO page linked in

2:59

the description and grab the chapter 2

3:01

asset pack, and that'll be in that zip

3:03

file. Okay. So, what we need to do

3:05

obviously is we need to have a way like

3:07

with our player here, we need him to be

3:08

able to transition. And I've set up some

3:10

extra levels here. So, I've got level

3:12

one. This is the scene and the level

3:14

that we've been working on um up to this

3:16

point with this series. And I've gone

3:18

ahead and made a level two, which is

3:21

pretty simple right now. And it's got a

3:23

little area that drops down here. I've

3:25

got a platform so that you can kind of,

3:26

you know, fall and land on it. You have

3:28

to drop down through it. And then I've

3:29

got a dungeon scene, level three, which

3:31

would be below level two. And so, I've

3:33

kind of lined up these areas so that

3:36

they kind of will match up. And you can

3:39

see what I'm going for there, right?

3:40

We've got it. Same width on these, which

3:42

is kind of important, I think, for

3:44

especially for a vertical transition,

3:46

you need to make sure they're about the

3:48

same size. If this one were like really

3:50

big over here and you jumped up, then

3:51

it's like, what do you do? Do you appear

3:53

in the ground, you know? So, just think

3:55

through those things. And just to

3:56

review, this is kind of the map. So, you

3:58

can see I've I've built this level and

4:01

this level and this level here. So, just

4:02

kind of this little section, and I'm

4:04

building the connections as I've mapped

4:06

them out. So, you've probably done

4:07

something similar or maybe you've

4:09

already kind of started building a whole

4:10

bunch of levels. Obviously, before we

4:12

connect them, it's kind of hard to work

4:14

with them. Now, one other thing that I'm

4:16

going to say about this and and this is

4:17

something that we're going to deal with

4:19

later on in this chapter. Uh right now,

4:21

we only have a player in our level one.

4:24

So, you could have a player in each of

4:26

these, and if you run that scene, then

4:27

you'll have a player in there. Once we

4:29

get to the point where we're really

4:31

working with these levels, we're going

4:32

to build a player spawn scene. And so

4:34

you can see I've got an icon already for

4:36

that in that asset pack. But that's

4:38

going to kind of alleviate that issue.

4:39

For now, we're just going to simply have

4:41

to start in our scene one here. And if I

4:43

go ahead and run my game, this is the

4:45

only scene that has a player. So if I

4:47

don't start here, it'll just be an empty

4:49

map.

4:53

But yeah, obviously I just fall to my

4:57

death or just into the the void of gray

5:00

where he falls forever. Okay. So, what

5:02

I'm going to do before we get started

5:04

with making this thing is I'm just going

5:05

to drag my player

5:08

over here to the side because as we're

5:10

iterating and testing, I want them to be

5:12

close to the point where I'm going to be

5:13

able to test. Okay. So, now when I run

5:14

my scene, I'm going to have my player at

5:16

the far right edge of this map so that

5:19

we're ready to just jump through to the

5:20

next. Okay. So, if you don't have levels

5:23

and everything set up, then make sure

5:24

that you do get at least two. Obviously,

5:26

I've got scene one and scene two here

5:28

are transitioning from the left and

5:30

right respectively. And then from two to

5:32

three, you know, two, we're going down

5:35

to the top of three and and up. Okay?

5:38

And that's going to be important because

5:39

we're going to make sure that our level

5:40

transition works with those four

5:42

different directions. So having at least

5:44

those two types of transitions is good.

5:47

Okay? For our level transition, I'm

5:49

going to make a new scene, and we're

5:50

going to use this scene, and we're just

5:52

going to have to drop it into our levels

5:53

where we want it. We could get away with

5:55

making this just like our level bounds

5:57

that we've made where it's just kind of

5:58

a new node type right here. In fact,

6:00

that would be an awesome exercise for

6:02

you to do. But for sake of simplicity

6:04

for newcomers, we're just going to make

6:05

it a scene because then we have a little

6:07

bit of control and we can see what's

6:08

happening a little bit better as opposed

6:10

to needing to do a lot of object

6:13

instantiation through code. But it

6:15

wouldn't be too difficult to do that. So

6:16

I think that's a fun challenge when we

6:18

get done with this if you want to make

6:19

it a reusable node. So the difference

6:21

being is obviously like this level

6:23

bounds that we've created in the past.

6:25

Um we can just add here from our create

6:28

new node. Okay? Because it's just like a

6:31

new node type that extends from node 2D.

6:34

Whereas a scene you would add with shift

6:35

control A and we've got scenes like our

6:38

player and you can see our levels are in

6:40

here as well. Right? So this level

6:42

transition is going to be a scene just

LÅS UPP MER

Registrera dig gratis för att få tillgång till premiumfunktioner

INTERAKTIV VISARE

Titta på videon med synkroniserad undertext, justerbart överlägg och fullständig uppspelningskontroll.

REGISTRERA DIG GRATIS FÖR ATT LÅSA UPP

AI-SAMMANFATTNING

Få en omedelbar AI-genererad sammanfattning av videoinnehållet, nyckelpunkter och slutsatser.

REGISTRERA DIG GRATIS FÖR ATT LÅSA UPP

ÖVERSÄTT

Översätt transkriptet till över 100 språk med ett klick. Ladda ner i valfritt format.

REGISTRERA DIG GRATIS FÖR ATT LÅSA UPP

MIND MAP

Visualisera transkriptet som en interaktiv mind map. Förstå strukturen med ett ögonkast.

REGISTRERA DIG GRATIS FÖR ATT LÅSA UPP

CHATTA MED TRANSKRIPT

Ställ frågor om videoinnehållet. Få svar från AI direkt från transkriptet.

REGISTRERA DIG GRATIS FÖR ATT LÅSA UPP

FÅ UT MER AV DINA TRANSKRIPT

Registrera dig gratis och lås upp interaktiv visning, AI-sammanfattningar, översättningar, mind maps och mer. Inget kreditkort krävs.