In this video, we'll round out our game with a nice overview intro animation,
something you see in some fighting games and some racing games, of course.
The idea here is to see how to sequence animations,
but not only, if I restart the game,
I can press a button to skip ahead to the countdown.
You'll see how to do that
and how to manage the game state basically.
With that let's get started.
I invite you to open the obstacle course scene
in the obstacle course part 2 directory.
We're going to get started by creating a camera.
Technically, we could animate the player's camera,
but as we mentioned before,
we can have multiple cameras in a game, in Godot
and just set the current property to true.
If I select the existing camera and turn on and off current,
you can see the purple line becomes a bit thicker.
What we're going to do is select the obstacle course node
and add a new camera 2D node as a child of it.
You can see a new pink frame appears
and we're going to move the camera somewhere else in our game.
Then we want to select the existing 2D camera
and turn off its current property because we'll start the game
with the new camera 2D being current.
Select the new camera and set its current property
to on in the Inspector.
In the scene dock, I'm going to rename it
to Overview Camera 2D
and I'm going to move it up to the top of my scene tree like that.
All right.
The pink frame tells you what the camera will show on the screen.
We want to show a bit more of the scene at a time.
Right now it's going to perhaps
pan a bit too quickly or show too little.
One thing we can do is in the Inspector increase the zoom.
You could set it to two by two.
It's going to make the view pretty large, but we can use that to have a slow pan
that's not going to give you
any motion sickness or something like that,
and show large parts of the level at a time.
From there we can start animating.
Select the animation player and go to the animation menu, new,
to create a new animation name, Course Overview.
In that animation we'll start by doing a couple of things.
First, we don't want the info number visible at the start,
so we select the info node and we're going to go down
to its visibility and turn it off and create a key frame in there.
We'll click create.
Well, one thing we can do just for safety is ensure that our overview camera 2D
is set to current at the start, so we can turn it on
and the Inspector and create a keyframe
for that in our animation.
From there we're going to animate the camera's position.
You remember how we did it before?
We used the icons in the toolbar at the top.
We're going to turn off rotation because we don't want
to animate the camera's rotation.
We only keep the location on and press the insert key
to insert a keyframe at the place the camera started.
Now this animation one second is not going to be long enough.
I invite you to crank up the duration to 10
in the top right of the animation editor.
Working to have maybe a good duration
to pan the camera is three or four seconds.
It has to be slow enough and long enough to give the player time to observe
what's in that part of the obstacle course.
Let's say roughly 3 seconds something, like one third of the animation,
I'm going to place the time cursor there.
Perhaps increased zoom level a little bit in my animation editor,
move the camera a little bit.
In that case, I'm going to have it move down,
up and down.
Then we'll have a camera jump to some other place
and move to the side and then jump there
and go back to the player, something like that.
Let me see.
I'm going to go back to the starting position
and then up and down a little bit
and press the insert key.
Then we move forward one key frame
and we have the camera jump to a different starting position.
Insert and I'm going to move forward in time
to six point something seconds and pan the camera a little bit.
This is not the most interesting part of the level,
but let's do that for now.
I'll have the camera jump again, like down there or up there perhaps.
Press insert to add a keyframe and go to the end of the animation,
move the camera towards the player, press insert.
You can now press Shift + D to see how the camera is going to show
that upper part of the level.
Then it jumps.
It shows up down the level and then it jumps
and goes to some other place.
There are a couple of issues there.
You can see how when we have the jump, the camera animates going down
and it looks really off
and it's going to be bad for the player's eyes.
We can select those key frames right before the jump in both situations,
and then we can right click the easing in the Inspector and set it to zero.
What this is going to do
is make the camera instantly jump to the new position,
which is something nice.
But then that jumping very sudden
is not going to be too great for the player either.
One thing we're going to add now is a fade out and in of the view.
We're going to fade to black when we reach the final position
and then fade in from the new position.