In this video, we'll look at the files in the Starter Project for this series.
In the course Downloads,
you'll find something called, godot-final-game-start-project.zip.
You want to download this and import it in Godot.
To import a project into Godot, you open Godot first.
Then you're going to click the Import button, on the right.
Go to browse and I'm going to go to my downloads folder
where I have the zip file.
Now, I already have the project here
so I'm not going to be importing it.
But you can continue by creating an empty directory and importing and editing.
But I will open this copy of the project I have prepared here.
You will land on the 3D viewport.
Because we don't have a main scene set in this project,
we'll be adding it later in the series.
This project has the same folders as the finished game.
However, we removed many scripts and scenes from it that you will be creating.
We did not remove all of them, though.
One thing we want with this series is for you to go read code
and learn how to work with it and tweak it.
In general, learn to work with other developer's code,
as this is a very important skill for game developers.
To get started, open the Room folder
and we're going to open the Test Room scene,
in which we'll be working for the first few lessons.
It contains a robot, a playable character,
and a dummy enemy that's just a damaged sponge.
You can press the F6 key to play the game
where you will see that the character moves,
just like in the Obstacle Course Series.
You have hands, you can rotate around the character
and this uses the same code as the Bats Raycast in the site-scroller.
Then if you click, it's going to fire bullet
and the bullet code and firing code is actually the same as the towers
in the Tower Defense Series.
In this video, we're going to be looking at the robot's provided code.
I'm going to give you an overview of how it works
because we did it slightly differently from previous series.
I'm going to double-click the robot and there we have a couple of nodes.
We have the robot.
It's a Kinematic Body 2D node and this controls the character's movement.
It also manages the character's health.
Then you have the skin.
The skin is a Sprite with an animation player.
One thing we did in this series is we split the code
for the character's movement and the code that updates
the character's Sprite and look direction, when moving into two scripts.
We'll see that in a second.
Then we have the Spell Holder.
This is very similar to the canon in the Tower Defense Series.
It's a point that rotates around another point that we use to spawn bullets.
If you look at the spell spawning point,
it sent an offset from the current Spell Holder node,
so that when you rotate the Spell Holder,
the spinning point turns around it at a distance.
Going to press Control Z to go back to the starting state.
Okay, let's look at the robot's code.
Click on the Script icon to open it
and there you will already see that it has quite a few comments,
so I'll let you read those if you want to get more information.
But the primary things that this group does is managing health,
so the character can take damage if it gets hit,
it has a movement speed and drag factor,
so it uses the steering equation that we saw before to move the character.
If we go down to physics process,
this code is basically the same movement code
you saw already in the Ship Project, you did at the start of the course.
You then have two functions for the character's health.
Set health only takes care of limiting the health.
It's going to clamp it between zero and the maximum health,
so it's going to keep it between zero and five.
So the health cannot go negative and cannot go above five.
If you go down, you have the take damage function
that is going to inflict damage to the character.
The enemy bullets,
the projectiles can call this function to damage the character on impact.
First, if the health of the character is lower or equal to zero,
it means that the character is dead.
Actually, we can check only for the health being equal to zero
and we don't try to take damage.
Then we lower the health by the amount of damage
we got through the hit and we have two conditions.
If the health gets lower or equal to zero, we could check if it's equal to zero.
Actually, we disable the character.
It's a function that's going to turn off the collisions,
turn off physics process and process.
We just kept it simple.
We just disabled everything we thought of at the time of writing the code
so that the character cannot detect collisions,
cannot be pushed by an enemy or anything like that.
There are no more interactions.
Then we call the die function on the skin.
On the skin, Sprite node that we have there,
it's just going to play the die animation in there.
We play the Death Audio that we have down here
in the scene dock and we hide the Spell Holder.
This is the node that has the hands that appear in the game.
We hide it just so that the hands are not visible when dying.
Otherwise, if we just took damage
but we did not die, we play the Damage Audio.
You can find this in the scene dock as well,
and we increase the shake intensity of the camera.
This is a property we prepared on the camera for you.
It will make the screen shake when you increase it
or when taking damage.
All right with that and the next video,
we'll move on to the character's skin.
See you there.