Hi, everyone, I'm Jeremy Gibson Bond,
and welcome back to the Unity Certified Programmer Exam Preparation course.
In this video, we're going to be giving you your first programming challenge
that's going to give you a chance to get your hands dirty with some C-Sharp code.
This challenge is the player ship movement and firing challenge.
So first, let's take a look at the game
as it will be at the end of this challenge so you can get an idea for it,
and then we'll jump into the details.
So, here I am in Unity.
I've got my game paused and I'm going to maximize on play and unpause it,
and probably zoom in here a bit.
Now, you can see that I can move my ship with the Wozney keys or with the arrow keys.
So the ship moves nicely and also you can see that it
does not have the square root of two thing where when I move on a diagonal,
it does not move faster on a diagonal than it does orthogonally.
Additionally, you can see that the turret points at the mouse no matter where
the mouse is and when I click the left mouse button,
the mouse button zero,
it fires a bullet and that bullet exists for two seconds.
Now, no matter where the ship is,
it will fire at the mouse cursor
which is nice and you can see these bullets wrap the screen.
Additionally, the ship wraps the screen.
So that's the result,
it's pretty straightforward but it's a place to start on this.
So, now let's take a look at this starter project that you're going to receive.
You can see here I've opened up scene zero,
which is already set up for you a little bit.
It's got the main camera set up as an orthographic camera and it has a size of
nine which works well with the 16 by nine window that we have down here in the game pane.
Now the game pane on your computer is probably not already setup as 10 ADP.
So, go ahead and create a 1920 by 10-80 resolution for this,
an aspect ratio for this,
to make sure that you're working at the same resolution that I am.
In here, you also have just a standard directional light and
then the player ship and we can zoom in on this model and you're on this game object.
You can see that the player ship has a collider
and then a turret rotator which will rotate the turret.
That's where you put the script to rotate the turret to follow the mouse and
then a model for that turret and a model for the ship itself.
You're not going to be doing this now but in course two,
you're going to be swapping out these models for
other ship bodies and ship tourists
and so I've separated them here in the prefab already.
There's nothing in the scripts folder yet because you need to write that.
Under the scenes folder is the scene we've just been looking at.
Under prefabs, you have prefabs for the bullet,
for the player ship and then again,
as a look ahead prefab ship parts for the asteroid ship zero and
asteroids turret zero though those are not actually used in this project.
Under standard assets, you see cross-platform input.
We're going to be using the cross platform input manager
to allow us to treat tilting a phone and tapping on
it the same way you would treat input.get axis
horizontal and vertical and input.get axis fire.
So, you can respond to the mobile input the same way you respond to the keyboard mouse.
So, that's something that I encourage you to use here.
Go and look in the inner documentation at
cross platform input manager if you haven't used it before.
Then finally, under textures and materials,
we have materials and textures and
a space background that you're going to implement in this challenge.
So, that's it for our starter project.
Now, let's talk a little bit about
some of the things you're going to need to implement. All right.
So as I said, we want you to use the cross platform input manager.
So, you're going to be using things like
the horizontal and vertical axes as well as the fire axis.
Mixture that that ship tilts with
the horizontal and vertical movement and fire using the fire access like I said.
The mouse is going to aim and shoot by clicking the mouse zero button.
You need to instantiate bullets,
have those bullets be destroyed after two seconds and have them
wrap around the screen and the ship is going to wrap around the screen as well.
The camera's already set up for you but you need to scale that space background to
fill the camera just in case you find
out that you aren't going to be developing for 10 ADP.
Then finally, particle effects are not necessary at this point.
I only mentioned that because you saw them in
the earlier video where we looked at the final game.
Don't worry about that right now.
That's it for this challenge.
I hope you have fun with it and I look forward to seeing you in the next video. Thanks.