Unity virtual space Game maker | Bomek Potel | Skillshare

Unity virtual space Game maker

Bomek Potel

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
31 Lessons (5h 2m)
    • 1. 01 welcome

      0:50
    • 2. 02 download and install unity

      3:10
    • 3. 03 setup unity project and asset store

      5:45
    • 4. 04 unity ui hiearchy inspector and layout windows

      13:38
    • 5. 05 unity ui scene game and project windows

      13:41
    • 6. 06 create the background

      8:33
    • 7. 07 create the player

      10:42
    • 8. 08 add camera movement

      5:56
    • 9. 09 add asteroid obstacles

      14:05
    • 10. 10 make asteroid prefab variations

      10:47
    • 11. 11 make a win condition

      11:59
    • 12. 12 create an enemy

      7:40
    • 13. 13 add the ability to shoot

      11:54
    • 14. 14 create explosions for the enemies

      8:51
    • 15. 15 add sound effects

      11:01
    • 16. 16 add enemy lasers

      14:16
    • 17. 17 add animation to the player and enemies

      4:20
    • 18. 18 make level 2

      13:22
    • 19. 19 make a build of the game

      5:22
    • 20. 20 add a start scene to the game

      17:15
    • 21. 21 add animation to the start screen

      11:42
    • 22. 22 add parallax and final touches

      14:48
    • 23. 23 make a 3d player

      16:58
    • 24. 24 make 3d asteroids

      9:10
    • 25. 25 make 3d enemies

      6:03
    • 26. 26 make particle explosion

      12:54
    • 27. 27 make particle explosion part 2

      8:11
    • 28. 28 add a particle asteroid field

      12:29
    • 29. 29 make final adjustments to level 1

      5:41
    • 30. 30 make final adjustments to level 2

      9:12
    • 31. 31 compile final build

      1:43
21 students are watching this class

About This Class

Have you ever wanted to make a game in the Unity game engine, but found the coding learning curve too steep?

This is the course for you! I have designed this course for complete beginners to Unity and game development. We will make a space shooter game from scratch without any coding! Instead we will use modular components which will add the functionality that we need. You will learn fundamentals like the 2d physics system, shaders, lighting and particles FX that can be applied to making your own games. Sign up today and lets make a game!

What are the requirements?

Unity 2017.3.1
What am I going to get from this course?

Make a 2d game in Unity without coding
Make a 2.5d game in Unity without coding
What is the target audience?

Anyone who wants to learn 2d game development using Unity without coding

Transcripts

1. 01 welcome: Have you ever wanted to make gains but found the process of coding to intimidate it. I certainly did. Hi, I'm voting Patel and I'm a 3D artists with 15 years experience in the various 3D industries. In this course, you're going to learn how to make a space shooter game from scratch using no coding. So we're going to be using snippets of functionality which you can combine together to create your game. We're going to start off with a unity interface. We're going to have a look at the 2D physics system inside unity. Rows are going to be having a look at creating particular effects from scratch. Rosa creates a user interface and create some harder levels as well. This course is for complete beginners and everything is explained including how to install Yeti. Discourse is also covered by Unity's 30-day guarantee. Of course, they've got nothing to live. So why not try out today and have a go? 2. 02 download and install unity: In this lesson, we'll download unity and install it. So I'm in my browser here and I've typed in Unity 3D.com. And this is what we get. And there's generally a cat unity button here. If NOT, there'll be a button up here as well. So let's grab that. Click on OK. And the one you want is the personal ones. So you're gonna click on Try personal. And then you've got to click to confirm the personal use. And that basically just says that you're going to make less than a 100 K and you close out of your games. Otherwise you have to get PRO license. So we're gonna click on agree and then click on Download. And that will download the installer. I automatically recognizes that I'm on a Mac, so it's going to download the Mac installer if you're on a PC or download the PC installer, and you can see it's downloaded it here. This will go to your downloads folder. You can see here, and just double-click that to start the setup process. And then double-click this and open. Okay, and we're going to click on continue engineer. And you have to agree to the license agreement. And then it asks you what you want to install. So we want to install Unity, of course. And this version of Unity is 2017.3.1, okay? So if you're in, if you're watching this from the future, you can download a archive from this. So if you just go over here to show you where the archive is. So if I look out to the Downloads section over here, just underneath the plans, and you can go to this site section here, and this is old versions of Unity. So if you click on there, you can see all the different versions of Unity and you can go back and install these. So we want 2017.3.1 and then you can just click on whether you got a Windows or Mac and then download the installer. Said this is if you're watching this later on and it's not the latest version, just so that we've got all the same version for this course. So let's get back to the Installer here. Okay, so this is the default options and I'm okay with that. We can install all this other stuff afterwards if you need to. So this is all fine. We just want the standard assets documentation, MonoDevelop, which is basically the editor for scripting. So this is what you use for scripting, but we won't be doing much of that. But you do need it. And then we've got the actual unity there. So I'm just going to click on continue filling the password to the hard drive. So it's going to go ahead and download and install Unity. So just follow the instructions and then come back after it's finished. So we are we finished installing and you can see, you can say launch zone as I close that. And it's going to start up. Unity is just check it works. Just check that it works and they go. Okay, so that's all working. So let's just download the project that we need for this course. So I'm going to close this up now. And in the next lesson we'll set up our project. 3. 03 setup unity project and asset store: In this lesson, we're going to set up our project. So just wanted to give a shout-out to cero continuity. You created this playground project and basically created it to teach kids how to make games. And it's really cool. And we're gonna use those elements to create our games. So you're going to download that from the resources attached to this lecture. And you say you should have this zip file. I've already done this. So it's in my downloads folder. So I'm just going to double-click that to unzip that. And inside there, the only thing we want is this playground project. There's Playground project is basically a Unity project. And so we're just going to copy that to wherever we want it. So I'm just gonna put it on the desktop for me. So that's unity and set this project and have looked at. So I'm just going to open up unity. Okay? And then we can open up a project so we can click on open here. And then we set the folder that we want. We want to go to the desktop. And then I'm just going to use Playground project wherever I copied that soon and say Open and just continue. This is basically saved in a different version of Unity and it's basically telling us that it doesn't match. So it's just gonna convert those files that it needs to. By the way, I've already logged in as biomedic. If he asks for a username, you need to register your name and just create an account is completely free, so you can just do that and then you'd have to login. Alright, so here we are. And inside the project window, which is this point here, you can see that we've got our assets folder and this is where our files are going to be. So we've got folder here for scenes, for example, which is going to contain our unity scenes. And there's a bunch of examples in here. So we've got defend the game, we've got football game, landa, maize and arrows, rogue like game. So if you're going to defend a, for example, and you click on one of these, which is basically a Unity scene. If you look at this down here, it says unity as a extension. So a defendant or unity, if you double-click that, that's basically a scene file and it will open and you can see that objects are loaded into the scene here. It says defendant, that's the C name, and these are the objects in the scene, and this is our hierarchy. Okay? So you can press play for example. And then you can actually start to play. You can use your, your arrow keys here and the space part to fire. Okay. That's not what I wanted to show you anyway, but this is how you actually press play and actually play your games. But what I wanted to do is actually import some things from the asset store. And the Asset Store is one of the best features of unity. It means you can basically download stuff that people have made and you can either buy it or get it down, get it for free, and you can basically get started really quickly. So if I go to the asset store here, just make sure that you've logged in. So I've already logged into its hasn't asked me for my password. Okay. So here's the Asset Store. So it has the Asset Store. Okay, so we're gonna type in sprites. And we went free. Okay, and we're going to download this 2D sprites pack from Unity. And Unity is a good place to start. So unities the publisher. And you can see the different types of publishers Here. You can download lots of different things like characters and models and all sorts of things plugins. So we're just going to get this 2D sprites pack. Ok, I'm going to click on import. And if you haven't already downloaded, it will say download. So I've already downloaded it, so it's going to say import, but you can press download and it will just take a few minutes just to download. Once it's finished, it will say preparing package. And then this will appear. And this is basically going to show us where it's going to add to our projects directory. Okay, so it's going to add a folder called sprites. And these are the things that it's going to add. So we can actually choose what we want to be imported using these take boxes. But we just want everything, which is just going to say a or, I mean all and important. Ok, so now you should have a folder in here with sprites. If you look down here and you can see these are the sprites. And then we're also going to download a another project. So if you type in Space Shooter, this is a 3D project and this is from Unity as well, this one here. So we're just going to download this, click on this, and then click on Download. Obviously I've already downloaded it, so I'm just going to click on import. And then it will give you a warning saying it's gonna import a project. So it's going to completely overwrite or your settings. So we can say import. And then it's gonna give us some options for what we want to import. So basically, I'm just going to turn everything off and the only thing we want is the textures directory. Let me just open this up here. So textures, so let me turn off everything else. Let me say all objects, none. And then I'm going to cut down two textures and just tick textures here and just import. This is basically called our background that we want for our game. So we're just going to click on Import. Okay, and then you should have a textures directory here. And then this is our Tal nebula here. So in this lesson, we learned about projects and Unity scene files. And we also imported assets from the asset store. 4. 04 unity ui hiearchy inspector and layout windows: In this lesson, we're going to have a look at laying out the interface. And we're going to be looking at the hierarchy and inspect to Windows. So let's have a look at this. We should have this scene opened. If you haven't, you can just get the scenes defender and just double-click this and you'll have the same happened. And first of all, let's have a look at this title bar here. So you can see that it's got some useful information like what version you're using and what scene is open. So we got defendant or unity, and then the project that you're in. So we've got the Playground Project which we unzipped earlier. And then the very important one of the build target, which is basically where you're going to deploy this to. This is going to be a PC or Mac or Linux standalone project. And then you bought version of OpenGL you're using. So some useful information of that. And then what's going to have a look at the layout. So you can change the layout here in the toolbar here. So you can see this toolbar here. And if you get to the right, you can see this layout dropdown. And you can change it to different layouts like two by three, for example, this is quite useful, is quite handy. You can see the scene window and the game window at the same time, which is really good. And you got four split default, which is what we just had. And then we've got tall, which issue got a tall game. So if you've got something which is long, which is kind of what we're doing with the space shooter. You can have this, this will give you more real estate to actually play with. But the game window is in the same tab next to it. So you can click on that to switch between those two. Ok. And then you've got the wide layout here, which is going to give you the maximum amount of area here in the view here. So we're going to just go to the default. But what we'll do is have the scene and the game windows open at the same time. So to do this, we're going to just click and drag the tab here. Just click and drag. And then you can talk it over to this side. So just hover over a, I'm still dragging. And then when you let go, you go to that position. So you can basically move these windows to wherever you want and you can see it gives you a little preview where it's gonna go. So it's pretty handy and pretty easy to use. So if you want to swap those around, for example, you can put out there. So you can have the scene window on the left side and the game window on the other side. You can see I'm re-scaling that as well. So you can hover in between here and you get out is two arrows. And you can just resize that as well. That goes for these windows here as well. You can resize, resize this, and of course, the project window here as well. Same thing. I'm just going to drag that down to, so it's bigger in this area here. Ok, we can save our layout so we can go to default and then save layout. I'm just gonna call this my layout. Okay, so you can switch to different layouts just by clicking on those. And if you make a mistake, you can always revert back to the factory settings and you can delete allow there as well. So these windows are different editors and we're going to have a look at a couple of those editors now, the hierarchy and the inspector window. So just have a look at this area here. If you click on it, you can see that you've got some little menu here. And it sort of tells you. Some options that you've got for this, for this window. So we've got no moon debug. I wouldn't switch to debug if I just select something here. Just click on main camera to select it. You can see it's blue when it's selected and the information comes up in the inspector when it's loaded. Okay, so we can click in here and go to debug mode. And you can see you get more information in each of these areas. So I don't I don't think I've ever used that, but this is just to show you. We just got to know more and that's got the regular attributes that you want to adjust the gate. So over here, we've also got lock and that's pretty handy if you want to not have this disappear. So if I click on lock and then select something else, let's click on background or something. You can see that the main camera still persists there because it's locked. You can see the little lock icon there. If you disconnect that, if you if you click on it again, it's going to unlock it. And you can see that that will update now so you can click on these different objects and it updates. Okay? And then you've got maximized, which is pretty handy, so you can maximize your window. You don't normally do it with the Inspector, but we can do it with other windows, such as the scene window, for example, or the game window. So if you hold down shift and spacebar, that's your shortcut. So if you click inside the shifting spacebar, you'll be able to maximize those very handy shortcut key that you use all the time. And then we've also got close tab, which is obvious. And then you've got Add tab, which you can add any of these windows again. So you can add another scene window, for example. So it's pretty flexible with really simple, but it's very effective of the Unity interface is called law of complexity, but its actually looks pretty simple, so it's good. So that's the buttons around here and how to move them around. So let's move on to the hierarchy. So I'm gonna move on to this hierarchy window. So to select, as we said, we can click on objects, we can hold our multiple objects. We can select multiple objects by holding down Shift and clicking underneath. And you will select a bunch of them just like in There's all Mac. And you can also hold down control to make a selection or Command on the Mac. So if you hold down command, I wanna maximum hunting them command and click on specific things that you want. That's how you make a selection. Obviously you can select things in the view here as well. So if I clicked in the view, I can select things. I've got the same window later. But this is the hierarchy window. This is everything that's in your scene. So these are all the game objects. So everything you see in here, the game object and the minimum property of being a game object is the transform component. So if I create a empty game object, so if I click on this, you can see it as a game object. And the only thing that's caught on it is the transform component. Okay, we'll talk more about components later in this lesson. I'm just going to delete that by right-clicking on that and saying delete. Okay, so you can see we've got a right-click menu, and we've got a little menu here as well, which is the Create menu. So you can create different types of objects in here, different types of game objects. For example, we can create a sphere cubed plus a square sphere fluid for example. And you can see in the viewport here, and there is in the hierarchy. And you can do that also from the Game Object menu up here. It's the same menu. And you can also do it from right-clicking. It's the same menu again. Okay, so I'm just going to right-click on that and say delete. You can also search for things. So you can click in here and type in, for example, cam. And then you can list anything with Cameron, the name, and you've got the camera there, for example, click on the little x to get rid of that. You can rename stuff here as well. So for example, if I wanted to rename the camera, I could click on it. And then you can say that it goes to rename just like in your operating system. Or you can press Enter or Return on the keyboard. And then you can also be nebula that, so you can are free to rename it there. So you can also rename it in the inspector of course as well up here. Another thing you can do in the hierarchy is Parent things up. So you can see you've got this little arrow here. So if you open up the arrow, you can see that the stuff inside there, that means that these objects are parented inside there. So if you move this object, the other, the other objects will move along. So if I were to double-click this, I'm going to frame select this. If I'm going to double-click this, I'm going to frame select that. Ok, so there's cannon frames. That extra double-clicking will frame the object, which is quite handy. You can also do that in the scene view here and press f in the scene view. If I put my cursor in the scene view and select something, for example, and press f. It's going to frame it out as well. So double-click to reframe. And so let me just show you how to parent. So if you just create a, for example, an empty object, and then create a, another object, just a cube or something. If you want to pair that, you just left-click and drag. And you can see it's got a little arrow. And when you get that little shape around the name, you can drop it and it will print out. Okay, so now you can see it's underneath there. You've got to make sure that it's underneath there. No single line. Single line is basically going to just move it in the hierarchy. So to unpaired parent that you can just move it until it's a single line. So if I left mouse button drag and move it up here for example, I can see, I can move it, whoops, and moved it by accident that I've just put up here. There we go. So I can move the order in which these things are sort of seen here by just left-click and dragging until I see a single blue line. Okay? So I'm just gonna get rid of that cube because we don't really need it. Okay, so that's the hierarchy window. We do a lot of work inside there. Let's have a look at the inspector and the inspector and hierarchy kind of go hand in hand. So if you click on some objects and select it, you can see the properties come up on the inspector. Okay, so there's a few things we can look at here. The first thing is this little tick box, and that means that the object is active. So if it's not active, you can't see it as you can see if you if you click away is black because it says no cameras rendering. And then if you click on it again, you can see is it's active again. So again, if I select this background, turning off, you can see that the background is not there. Today on again is have a look at the color of this in the viewport. If I click on this, you can see that it's kind of grayed out. That means it's inactive as well. So you can do that in code as well, by the way. And we're going to have a look at that in using our code free version now, components that we're going to use, and it will do that later. We can also have a look at this little thing here, which is called an icon. And so if I click on this and just click on any of these little capsules here, you can see that I get a little capsule with the name of the object, and I can click on that to select it, which is pretty handy. Okay, so if you've got something which has not got an icon, you can actually make an icon by just clicking on here and then clicking on these little capsules here. Or you can click on the little ones underneath as well. Okay. I'm just gonna change that back to none. Now, underneath that we've got the tags. So the tag is a way of letting the computer know what an object is. So for example, in the camera, you can see it's got tag of main camera. So the computer, the program doesn't know what the main camera is. The everything's the same to it, so we're going to tag it. We're just going to say this is the main camera. And that's pretty handy. So you can see we've got a bunch of different tags like enemy and player, and different things like that. So we've sort of built into the playground projects which were imported when you open the project. And some of them are default ones. So we can, we can tag things different objects just by clicking and picking attack. We can also click on Add Tag. And then you get the tags window. And you can press this little plus here and add another tag if you want to. Okay? So these are the custom tags that have been added. And there's, the other tags are the default tags that are included inside unity. And let me just select the main camera again. And then we've got layers. And layers are used for sorting. So for example, if I click on here, we've got a few built-in layers for UI, for example, water, and a few different built-in layers. But what we can do is add a layer, for example, we can add a layer here. And then we can click down here. These are the default ones that you can't change those. So you can type in, for example, enemy. Okay, and then we could add this asteroid spawner and just click there and say enemy. Okay, so now what we can do is in the layers drop-down here, we can actually turn off enemies like that, okay, so we won't see the enemies. So this is basically an organizational thing. You can also click on the little lock button so you can lock it from being picked. So it's sometimes very annoying when you're trying to adjust your scene and you keep selecting the background. And it's easier if you put it onto a background layer and then click on this little lock, and that way you won't be able to actually pick the background. Ok. These are the layers are called Sorting Layers and therefore sprites. So when we're using 2D mode, this is a 2D mode. If you look down here in the scene section, and we're making a 2D game. And the way the computer knows what to draw on top of something else is based on the sorting. And we'll talk about more about this later, but this is a sorting layers as well. Okay? So layers are used for organization and sorting in terms of sprites, OK. And another quick thing now just wanted to show you is that you can select multiple objects at the same time and edit them. So for example, if I were selecting these two objects here, oops, hold down shift. And you can see that it basically gives you the common components that the object has. A. For example, these two objects have got this transform component in common. So if I were to select something and change it, it will change it for both of those. If I wanted to turn this off, for example, for both of those, I could do it at the same time. So this is multi-object editing. So it's pretty handy because what you can do is if you've got a bunch of enemies or something, you can select them all at the same time and, and adjust some settings on them. So it's really handy. So in this lesson, we started having looked at the user interface and had a look at the hierarchy and inspector windows. And we also made our own layout with a side-by-side layout for this scene and the game. Windows. 5. 05 unity ui scene game and project windows: In this lesson, we're going to have a look at the scene and the game views. So the scene view is where you do all your work. Say, this is where you place your objects, move them around. And that's all thing. Will have looked at this in more detail as we do stuff obviously. And so you can see, if you select your camera, you can see a preview of what you see through your camera. Even though we've got the game view open here anyway, up here we've got a little toolbar and we can change the way the C looks by changing this. So we continue to wireframe, for example. And we'll see just the wireframe as you can see. And you can also see the shaded with the wireframe. Sometimes that helps to zoom in here you can see that wireframe there. And then we've got 2D mode and 3D marriage. If you click on this, it's gonna go to 3D mode. And you can see that if I use my mouse wheel, I can zoom out here. And let me just show you the view controls. If you use your Alt on your keyboard and how Daniel left mouse button. You can orbit around, so you're rotating around. You'll see you can use your middle mouse button to pan, okay, or track. And then you can use your right mouse button to zoom in and now, or you can use your mouse wheel to do that. Alright, so that's just holding down all at the same time. Make sure you hold down Alt at the same time. Okay, so in this 3D view, you can see that we've got the x, y, and z here. This is the gizmo. And you can actually click on this to CO2, the front view for example, or the top view or whatever. Okay, and in this immunity, the up axis is the y-axis. So let me just rotate this. So you can see here that the up axis is the y-axis there. Some other programs like Blender or 3D Studio Max have set up, but this is why app. So the front taxis is the z-axis and the side axis is the x-axis. Okay? You can also look at a orthographic version of this scene. So if you are looking from the top view, for example, and you wanted to see an orthographic version, which is the version without perspective, you can click on this button here and it's going to turn into the orthographic version. And you can see we have now perspective in there now. So you can see it's like a Plan view. And let me go to the front view. You see this a bit better. So you can see this looks very familiar. This is basically the same as your 2D view. So if you press 2D, what you're doing is you're looking down the Z axis here. So I'm in isometric mode here. And you can see it says iso here. That means we have no perspective. So you click on that again and you have perspective. Okay, so moving along here, we've also got our button for the lights so you can turn on lighting or turning off, then we've got our sound button. So if you click on that, you're going to turn off the sound or turning on. Normally it's off just because it gets really annoying when you're, when you're testing the example, if you want to tell it on, you can actually hear the sound in your, in your viewport when you, when you, when you're working. And then you can turn the visual effects on and off. So you can click on this button and you can click on the little drop down to see the different types of visual effects like Skybox is 4k flare, et cetera, et cetera. So we can turn that off as well. This is a pretty simple thing. This is a 2D scene, so we don't have those features that we can't see much of that. And then we got Gizmo is basically, basically this is the stuff that you see in here. So you can see a camera there, there's a camera. And if you look at gizmos here, you can say turn this off and you'll just have the gizmo. There is a 3D icons. And if you want to get rid of those, you can just change that to size of 0 and you can make them bigger as well as you want to say, you'll see different things like if I create light, for example, square point light for example, you see that the gizmo, the light is like this. And then if I were to turn this off, you'll see that it just changes to a constant size. So this will actually zoom in around a zoom in or out, it would stay the same size. Whereas the 3D icon does change to a bigger size or smaller size. You can change that here. And then you could turn off the different types of gizmos here as well. And you can also turn on selection wireframe. So if you've selected something, you'll see a orange line around it. Say if I select this only works for 3D objects. So if I go to create cube, for example, you see an orange line around it. And if I turn this off and you can see that it disappears, okay, so that's the orange line around it. So it just shows that you've selected something. Okay, so that's the gizmos and we can search for things as well in here, just like we can win with the hierarchy, can type in camera for example, and it's going to gray out everything else apart from the camera. Ok, so now the Game View, of course, we've got a game view here and this is where you can see your game playing. And when you press Play, this is basically going to come Active. By the way, my whole screen turns green because of set in my preferences to change color. So let me just show you how to do that. If I go to file, it's just off the screen here, but I'm just going to Unity Preferences, okay? And if you're on Windows, it would be in the file menu actually. And then you can go to colors. And then you can go to play mode tint and just put it in color here. And that just makes the screen tinted towards a color so you know that you're playing the game. Otherwise sometimes it becomes confusing because you make some changes and then they don't take effect. Because anything you do in the game mode will not take effect. So if I press play, you say that the game is playing. And then you can zoom in or out using this. And this is just zooming in the actual image. So it's not actually going to be sharp or anything. It's just gonna blurry. It's going to be blurry because you can see the pixels there. So it's just if you want to zoom in, if you want to, and then you can also maximize on play. So this is a common one that we use. If you turn this on and press Play, it's gonna get full screen. There we go. And that's quite handy. Now for now. And we can mute the audio as before. So sometimes when you're playtesting this stuff against doing just listening to the music again and again. So you can turn that off. Then we've got the stats, which is pretty handy. And the stats will have the frames per second. You can see here it says frames per second FPS. And this is really handy count of how fast our game is. Normally in a 2D game, you, you're going to have pretty fast performance. So you can see it's got like 99 frames per seconds on times. So that's fine. Anything up to 60 frames per second is super-fast anyway. And then you've also got some other bits and bobs here for performance that measure performance like draw calls and different things. So we'll have a look at that a bit later. Okay, then you can turn on gizmos in the viewport. So if I turn that off, you can actually see that gives me that you see in your view here, in your scene view in the game. That's just for debugging purposes. So if you turn that off, he went there to see your light icons and things like that, which is probably what you want by default. You don't want that to be on. And that's just going to have your gizmos for your lights and cameras and stuff in this thing. Okay? This display here is not change very often is basically, if you've got multiple cameras in the scene, you can have multiple different game view. So for example, this game camera here that we've got a camera, the main camera. You can go to Target display down here, the cameras section, and you can see that the target is display one. So if I change that to display two is going to disappear. And if I change this to display to you, you'll see again, okay. So basically you can have multiple cameras going to multiple different displays. So in this, in most cases you don't really need that. Then you've got the aspect ratio. So you can set certain aspect ratios. For example, if we are going for a screen size of 69, you could change that 69, which is normally a movie aspect ratio, for example, or some 4-3, which is an old television, and different types of aster aspect ratios. And so you can add your own resolutions by clicking on the plus and putting in the height and the width in pixels. And then it will fix it to that sort of size. Okay, that's good if you want to preview it because you're obviously going to be previously in the window here. So if you're making a game for, for, for mobile for example, then you want to keep the aspect ratio for, for mobile occur thin screen. Okay, I'm just going to change it back to free so that it just fills the screen. Okay, let's look at the project window. So if I just make this a little bit wider here so we can give them more room. So we've got the assets folder and that's contains everything that's going to make up your game. So, and so that includes scenes. That's the main thing of course. Then we've got objects as well. So things like our sprites here, sprites. And then we've also got things like sounds and textures and all sorts of other things like scripts and stuff like that. So all that stuff will be contained inside the assets folder, okay? And we can search the assets folder using this here. So we can type in something that we wanted to. We can also search by type. So if we wanted to search for a scene, this is basically all the scenes in the folder. So if I just change that to seen as pretty handy so you can use that quite a lot. So you can just quickly switch scenes and then grab the one that you want. So it's just sometimes handy to do that than to actually type in something. So I'm just going to turn off. You've also got different, other different types like script, which is quite common one. And then we've got Obviously welding a scripting and this one, But these are weather scripts are, this is going to be the actual things that are going to be applied without being premade. And they're going to be applied to our objects. And then we've got sprite, which is going to be our objects. They are actual players and enemies in our game. So you can see all that stuff here. So that's pretty handy. So this is the by type and then you've got by label as well. So you can label these assets. If we go into the sprites folder and you can see we've got this stuff here. You can see there's a little slider here. You can make that bigger and smaller to make these previous bigger and smaller. Okay. And inside here and we've got retro. So you've got retro here, retro bullet, retro explosion. Let me just make this bigger. And veterans spaceship. So we're going to use these three and this rocket ship in our game. So I'm just going to make a new folder here. If I right-click here, I can go to Create and then create a folder, okay? And that will create a folder inside there. And you can call that whatever you want to. I'm gonna be calling it space shooter. Okay, and this is just for organization. We can just drag these guys into here. And that way, we know that we're using those skirt that retrieval and grabbed this rocket sprite as well. Ok. Anything else? Not for now. Inside this folder I've got these four spreadsheets, okay? These four sprites. And inside here, you can press the little fly out here, this little arrow. And you can see that contains the different sprites. So you can actually pick these individually. And they've been split up inside here. So we'll have a look at that a bit later. So the label refers to this area here, this preview area which comes up at the bottom of the inspector. You can actually make that bigger here. And you can actually put a label here. So if I change this to the spaceship here and maybe select some of these Haldane's shift and select all of these. I can click on here and call that character, for example. So I've tagged that as a character and labeled as a character, you can say down here. And so now if I click on here and say character, it's gonna show me everything with the character label. Okay? We can also make our favorite if you want to. So for example, we can for in scene and add that as a favorite presses Leo star. And it will appear over here. I'm just going to call this scene seems again. So now if I click on that, it will give me all the scenes. If I click on this, it'll give me all the scripts. If I click on this one is all prefabs and we'll have a look at prefabs later. Prefab as a way of saving out these game objects after you've applied stuff to them, like components to them, will have a look at that a bit later. We've got all the models, all the materials, and all the seeds. Okay, so this is what the favorites buttons do. Ok, let's have a quick look at the console. The console is basically where Unity talks to you, say basically gives you errors and warnings and all sorts of things. So basically this is where you look if something goes wrong and you can see, you can turn things off here so you can turn off warnings, dialogues, and errors. Ok, so these are the different buttons. If I wanted to turn off errors, I can press that. You've got this pattern here for clear on place. Every time you press play, it's going to clear this stuff. And then it will show you the new stuff. And you can also turn on error on pause. So if it creates an era, you can automatically pause and then you can see the error as well. You can also press this button here to clear it. Ok, so the console is where you'd go to see any messages from, from unity. You can also see a little thing down here as well. When he plays, if I press play, it's not giving me anything in this particular say if it hit something, maybe console message. But you get the idea, we should see this as we go through the project. So in this lesson, we have looked at the same window, the game window, and the project window. 6. 06 create the background: In this lesson, we're going to start our game by creating our background. So let's go ahead and go to a new scene. So I'm gonna go to File. And you see it's just off the screen here. And we don't want to save that as fine. Okay, so now we've got a new scene. You can see it says untitled here. So what we're gonna do is we're going to drag in our background, and that's the image in the Texas directory. So if you get to the textures directory and click on this tile nebula, you can see the preview here. If you can't see that, just make that bigger. And just a note here, you can actually slide this down so you can see the different levels of detail. So these are the lower resolution versions, the MIP versions, versions. So it's just good to see. And you can also change the size. So when you bring it into unity, you have a bunch of options here of how to import this. So what you can do is actually set the maximum resolution here. And we'll have a look at this in just a second. But first of all, we need to change an attribute on this. We need to tell unity that this is a Sprite, not a texture. So at the moment it thinks it's a texture. So if we were to try to drag this in here, you can see it doesn't let us. So what we're going to do is just change this to a sprite 2D and UI type, okay? And then just make sure that you apply that. Click on apply here. Okay, so now that sets And now you can see, you know, it's a sprite when you get this little triangle here. And you can open that up and you can see this the sprite inside there. So you can just go ahead and just drag that into the viewport or inside the hierarchy. And you'll see your texture there. Okay, now, we should work in a 2D mode here. So click on 2D here. And that way we'll see that and we can double-click this to center it up. So now we've got our texture, them, our background Sprite. If we select it, you can see that this is the attributes on that, the parameters. And you can open up the transform tab here, the component here, and you can adjust where it is in space. So in here you've got your slider. So you've got the X and the Y. So the x is the left and right here. And the up and down is the y. Ok, and the zed is going to move it along towards us in the camera. So a way for us away from us or towards us. So we don't normally adjust that in a 2D game. And so what you can do is reset that we can click on this little cog here and just click on Reset. And that's just going to reset that alter 0-0, 0-1, just the default. You can also reset individual things. So for example, if I was to rotate this in the x direction, for example, so it was the wrong direction in the y direction. And I wanted to set that back to the default. I could go to reset rotation. And it's gonna keep the other ones the way is the other position and scale the way it is. Okay? So we can also move this around using our tools down here. We've got our move, rotate and scale. And the shortcut for those is w, e, And all same as Maya or in 3D Studio Max. So you can change to these quite easily. And you can see the little gizmo here, and you can just click and drag. He's your left mouse button and drag. And you're gonna move around up and down, left and right. You can also use the square in the middle to maybe around it, both axes there. And you can see the things changing them. So I'm just going to reset that. And it's the same thing for the rotation here you can see we've got this circles instead, so you can rotate these. And for the scale, you can use these little squares. Okay? And then we've also got this mode here, which is for move, rotate and scale, all in one little gizmo say you can scale, rotate and move around. Okay, so the arrow is the move, the square, and then you got a cycle. So whatever you prefer, it doesn't really matter as long as you make this round. So I'm just going to reset this and I'm going to just move it across. So I'm just gonna use the move tool and I'm just gonna move this across. And using my grid, I'm just gonna put it in the middle to zoom in here. Just put this in the middle here. Okay, so I've got about minus 5.1.2 two if you're copying, you can just type the end if you want to. You can put your mouse into there and then type in if you want to. And then what we're going to do is we're going to duplicate this. So we're going to select this and go to Edit, Duplicate. And the shortcut for that, which I'll use from now on is controlled d k. So Control D or Command D on the Mac. And you'll create a copy of that and thereby if on top of each other. So we just knew this across to the side. And then quite background. Okay, so I've just made that bit wider. You can see it's a tolerable background, so that's pretty cool. So that means one side joins onto the other side. And so that means that we can actually duplicate this upwards. We're going to be creating this space shooter going upwards. If you're going left and right, you can duplicate them left and right. So this way horizontally, but I'm going to be going upwards. So I'm just going to select these two again, hold down shift. So I got both of those selected. Press Control D, Command D. And then this time we're just move them up and zoom in a bit here. Okay. Something like this, 20.49. So we're moving upwards in the y-direction. Yeah. Okay. And then we're going to select all four of those and just duplicate it one more time. Okay? I'm not going to make this too big because it'll be easier to play test it. But you can make it as big as you like and do whatever you like in terms of the size of the level, this is going to be one level. So Control D, sorry, Command D. I'm used to being on a PC. Okay, so now we've got our backgrounds all lined up there. So what we can do is let's just have a look at the texture size here. So when you're making games, you always have to optimize everything so that it runs in a fast way. And second, when people download these games, they're not too big. So texture size is normally one of the biggest culprits for, for the size of the game. And so you can select your texture here. And you can change the size if you want to, and you'll see k blurrier. So if you can change this to, let's just do an extreme. I'm going to just change it to 512 and say Apply. And now you can see that the texture is gone, blurrier, but this is non-destructive so it keeps the original so you can just change the import settings and Unity will do that for you. So I just wanted to show you that because Unity takes care of all that for you. You've also got different algorithms for filtering this as it resizes it, and the compression as well. If you wanted it to be more compressed, when you make a package out of it, you can change that as well here. Okay, so what we're gonna do is just to tidy this up a little bit. So we'll just create a new empty game object. And I'm just going to click on that. Or you can press return on the keyboard and I'll call that background. Okay, and then there's a select these guys. So click here, hold down shift and collector on the bottom one, and then use your left mouse button and drag and this drag it in there until you see the arrow and the capsule around it. So you should see something like that. And it gets parented up so that you can just close it up and it's nice and neat and nice and tidy. So finally, let's just go ahead and save this. So I'm gonna go to File, Save Scene ANCE and, and again, you and your assets directory here. So what I'm going to do is just go into the scenes directory and I'm gonna create a new folder here. And I'm just going to call it the space shooter. So space, Let's do an underscore the Create. And I'll just call this special. I'll just call this a one to indicate that it's the level one. So if you wanted to create other levels, you can call those other levels. So 0203, for example, and just click Save. Ok. So now that scene is saved. So in this lesson we've imported in our background as a sprite and later out inside our 2D view here. And we've saved the same. 7. 07 create the player: In this lesson, we're going to import our player in and make it move. So we're gonna go into the assets folder here and the Sprite section. And as open up the folder that we had, the space shooter. Okay, and this is the one we want, this spaceship, retro spaceship spreadsheet. So you can see that basically this is a texture. If I were to right-click this and say open and see that it's a PNG and it's just like small texture with these images air. And these are frames for an animation. So for example, this is for the rockets firing and then you've got the ship rotating or turning. Then you've got the ship turning, and then you've got the ship firing. So these are different animations that you can sort of swap out the textures for. Basically unit, you will figure out that this is a grid of sprites and actually cut those up so that it makes multiple sprites algorithm. To do that, you've got to Sprite editor. And you can see here, so it automatically does it, so it's done it for us, but just wanted to show you where you'd go to adjust this. So if you go to the sprite editor, you'll get this window. If you, if you don't see that you can make it bigger. Describe this again. And we just talk this so it's a bit easier to resize. Select this texture. Ok, so you can see here that we've got an automatic mode. So if you're going to slice it set to automatic, so it's basically going to figure it out and just cut it up into slices. And that's what this is. This version is, and this works out in this particular spreadsheet because we've got regular intervals. So these grids of like certain number of pixels thing it's like 48 pixels and the images are inside there. Sometimes it's just not the case. So you have to change this to and by number of certain number of sprites. For example, you might have like five sprites by ten sprites or whatever. And you can also say grid by cell counts. So you can actually type in how many sprites are inside this spreadsheet, okay? So you can override the way cuts up this stuff and you can slice it manually as well if you want to. But we don't need to do that in this case, I just wanted to show you the sprite editor is that. So once is sliced up, you can see that there's different images here. So we just have to drag one in. So I'm just going to drag this first one, the spaceship 0. And that's basically caught just the rocket firing. So I'm just going to drag the end and I can get rid of my sprite editor here that need it. Let me just get rid of that. Okay, and let's have a look at the spaceship. So if we double-click that, we should see that we then, And the reason we don't is because of the drawdown. Okay. So this is something I mentioned earlier. This is basically in a different layer. So they will both on top of each other and the background is on top here. We can adjust that by adjusting the sprite renderer component here. Okay? So this little section here is called a component. And you can see there's a transform component and there's a sprite component. So Sprite Renderer component, and that's what makes it sprites basically. So all the different types of objects are basically just a game object with different components attached. So for example, if I was to select the camera, you can see that it's called a camera component attached, flare layer and audio listener. And there's a default components that are added to this object. You can add components by clicking on Add component. And you can type in something or you can pick by category. So for example, if we wanted to add audio listener, you can come in here and say audio source audio listener. And we can add that component. And the other thing we can do is we can go in here. And if we want some help on this, we can click on this little question mark and it will open up the Help and it will go directly to the section on the sprite renderer. So if you want to know what these attributes do, you can always go in here. And it's really good. Just minimize that. So that's for each of these components, you can press that. And then obviously we've got this clock here and you can copy and paste components as well, so you can copy them from one object to another object. You can also remove component by clicking on here as well. So that's by clicking on this little cog here. Okay, so what we're going to do is just change this draw mode here, sorry, the sorting layer here. And we're just going to change this from default to gameplay, okay? And so this is going to be for the ship. We're gonna change that to gameplay. Also. We're just going to change the background here, these nebulae ones. And we'll select the sprites and then will change those. And which selecting all of those together will change those to a background layer. Ok, you have got another alternative way of doing this as well. You've got the odor in layer, so the higher the number, that's the number that will be on top. So if the spaceship had one than it would be on top of the background, which is called 0. So there's another way of doing it. You can add other sorting layers in here. So you can just click on add sorting layer and then just press plus and then add more layers as well. So you can add a layer for enemies and different things. So this is how unity knows what to draw on top of other sprites. So now that we've got a spaceship here, we need to make it move. We're going to do that using these handy components that Cheerio has made in the playground projects. So if we go to the scripts directory, we've got different folders for the different types of gameplay that it provides. So we've got movement, destruction and creation, conditions and attributes. So an explanation of all these is provided in the root here in scripts explained. So if you open up, it's got a brief explanation about what these things do. But we are going to be looking at these anyway. So let's go to Scripts, back into scripts here. And we're gonna go to movement. And we want to have the move with arrows. Okay? So we're just going to click that. Let's just click on a spaceship Fest. So there is a pair, and then we're just going to drag this move with arrows into there. Okay, so now we've added that component and you can see that there's another component added to. So we've got this script here. You can see it's a script because it's got the C-sharp icon here. If we close it up, we've also got this Rigid Body 2D component. Okay? So this is how we can actually move the object. We're moving it using the rigid body 2D note here. And basically it's going to use physics to move. It's going to apply a force in a certain direction depending on the key that you press. And that's going to move our object. So if we press play. You can see if we just open up the move with arrows here you can see, you can pick whether you use the arrow keys or the WASD keys. So you can choose whichever ones you want. And then you can pick the speed at which that thing moves when you press the button and what type of movement you want. You can have in all directions or only in the horizontal direction or vertical direction. So we also have the orientate, orient to direction which will rotate it. So let's just have a look at this while we're playing it. So I'm gonna press play and we're gonna get this. So basically the gravity is on. If I'm pressing my upcase. She'll say, if you press it for a little while there is, It's getting really fast. The basically the object is falling downwards. So let me just press this button again and you'll see what I mean. So this is how we've made our scene. We're going upwards here. And so the gravity goes downwards obviously. And the gravity system is pulling the shift downwards. So we don't actually want the gravity to act on this. So we're just going to select this guy. And remember, you can't select anything in the game view, you can only select it in the scene view. So Skype activity here. And I've just got to my spaceship here. And so if we select that guy, we can actually turn off the gravity coming here. And we've got gravity scale, which is going to change that to 0. Okay, so now we press Play. It should stay where it is, ok. And if you press the up arrow, it should move along and it moves really quickly. Okay? So what we want to do is maybe changed the movement speed to one. Okay? And then what we're gonna do is put a little bit of dragging them. So this stuff here is for the drags that is linear, drag was the one we want. So let's just try this alphas. So I've changed the speed to one and press play. Okay, so you can see it's got a bit carried on. Going where space, where have you click the arrow is I'm using my arrow keys. Yes, it's just coming in and our view. So basically we need a little bit of drag, so it just slows down straightaway. So let's just change this. Drag too high a number. So they slows down straightaway. Ok. And I can see moving extremely slowly. It's a bit too either. Let's just change this to ten and then press Play. And then we're going to change the speed compensated. So it just changes to five, maybe default Valley, press play. Okay? So now you can see we've got this kind of movement here. And as we said before, if I turn off maximize on display on play, I can actually adjust this stuff while I'm, well, I'm working with it. So if I press Play, see, I can actually see it moving. And then I can show you this attribute here, oriented direction. If I turn this on, you can see now, if I go downwards is going to actually point downwards and point left or right. So that's for different types of games. So if you want to do kind of a racing game or something like that, you can do, or a character moving around like Zelda for example. You can use that oriented direction. In this case, we don't need it because we are going to be pointing upwards. So we're just going to turn off. Yeah, if we stop pressing play, then that's going to put it back to the original value which was off anyway. So that's cool. And so now, so now we've got an object moving. So just to recap, we've added this move with arrows script, and that's basically a little script which allows you to move using the arrow keys or that WAS WASD keys. And you can use those to move around and it adds a force to this rigid body. And so we've turned on the gravity and we've turned up the linear drag to select, slows it down a little bit so that we get a predictable movement. Okay, let's save the scene file. Saves ints. 8. 08 add camera movement: In this lesson, we're going to add movement to our camera. So at the moment, if when we press play, you can see that the camera doesn't move. So basically the ship will just go off the screen. So we want our camera to follow our object and we've got the perfect script for that. So if you get descript, movement and kamara follow, and we're gonna put this onto our camera. So let's select the camera and just drag that onto that. Okay, so now we've got a camera follow added and it gives you a warning saying, should be following a specific object, usually the player. So there's nothing selected here. So we can click on this little dot here. And this gives you a list of all the objects in the scene or the assets in the same. And you can click on one of those to follow. So we can click on the spaceship here. Okay? And then you can press play. By the way, the shortcut for this is control P or Command P on the Mac. And then you can move it along and you can see that it's following. Okay. But easy. So stop that. Let us have look at the camera here. I just wanted to point out that this is an orthographic camera. And the way you decide on what is seen in the, in the actual scene is not the angular view like a normal perspective camera, but it would be the size parameter, okay, so the size parameter, if you want it to be wider, you can make that bigger. If you wanted to be closer, you can make that smaller. Okay? So I think that default was about four. Just gonna undo five there. And the place where you set whether with orthographic is in here, this projection section. So you can change that to perspective if you wanted to, if you're going to turn this into a 3D game later on. So by default, because we opened up our project, which is a 2D project, you can see that it's set the scene to 2D in terms of the display here in this, in the scene view. And the camera is set to orthographic, but it doesn't really matter. They're just settings really the 3D scene and the 2D scene is exactly the same except it just changes a couple of settings inside the Unity project. Okay, so let's just go ahead and adjust this a little bit. And what happens is at the moment, it's exactly in the middle. So this will be a little bit tricky when you're playing the game. And the obstacle, obstacles will come from the top here. So you won't have much time to actually move this ship around. So you want a little bit leeway there. So we're just going to move this down a little bit. So what we can do is we can create a null object which the camera will follow. So we can have a bit of an offset. So let's just create an empty object here, game object. And I'm just going to click on that and call that look at because it's going to look at that. And then we're going to parent that into the spaceship. So left mouse button, drag that onto the spaceship until you see the capsule. And then let go. Try that again. So now you should be underneath there. So it's parented up. And lets just double-click that. And it's in some weird position here. So let's just reset this. So it should be right in the middle of the spaceship. So let's double-click that and just double-click a spaceship actually. So wherever you can see, if you are on the move to here, wherever you can see that that's where it is. So you can see it's exactly in the middle of the spaceship here. So let's set the script to actually look at that object rather than the spaceship. So just go to the camera and then go to this. Again, click on that and choose the object. Okay, so now it's gonna follow the object. So now what we can do is have a look at this press play. Okay, it's going to look exactly the same, except what we can do is take this object and just move it. And you can see the KML update while it's playing. So that's just a justice to wherever you want to and something like that. So I've got like 3.23. Just remember that number or you can copy it. I'm just going to copy it and then stop the game and just paste it in. Okay, so offset. There we go. So now we've got a nice little bit of leeway there. And you can see that the object is kind of jogging. They're just kinda looks a bit where it's kinda jittery, like it's running out petrol something. So let's just adjust this. So this is because of the anti-aliasing. So we can just in the quality section. So if we go to Edit Project Settings, quality, this is what we going to adjust the quality of our project. And the moment is set to fantastic, which is pretty high for a 2D game. So what we need to do is just change this anti-aliasing attribute here. So if we just change this to disabled, we won't get that weird behavior. And he aliasing is basically going to try and smooth out the edges of things. And in this case, we don't actually want it to you because this is a Sprite and it's better if it doesn't do that, then you won't get that git, that jittering. So hopefully if we just press play now should just fix that. So they guys lot smoother now. And a member should just set it to fastest. And then press play. Some maximizes. Okay, that's been up. Okay, so in this lesson, we set up our camera so that it follows our player. Just gonna save the scene. 9. 09 add asteroid obstacles: In this lesson, we're going to spawn some asteroids into nothing. So we've got our spaceship moving and let's add some obstacles. So let's go to the sprites folder here. And we've got this asteroid, and I've gone to put that into the other folder. So that's just meta in as well just for housekeeping such as asteroid into space shuttle to so that they're all in the same place. Okay, so crack this asteroid sprite into the view here. And we've got our asteroid there. Okay, so at the moment this is just a picture. So what we can do is let's just make this smaller festival. And I just take the scale here. And you can see the scale there. And I'll just turn off gizmos here for a second. And then let's just make this smaller, maybe, something like this. Okay, we can vary the size. We can make a few of these if you want to create a few different versions. Let me just move it aside here. Okay, so we call our asteroid. Yep, and what we're gonna do is create an object which spawns this. So we're gonna make this as a prefab. And a prefab is basically an object with all the saved components. And we're going to basically drag that from our view into a folder here and it'll become a prefab. And we're just going to add a few different components to this so that we have got what we need. So first of all, Let's create the spawner. So we're going to create a brand new object, empty object. Okay, and I'm just going to rename the spawner. In fact, let's call it asteroid spawner. So if we add an enemy one later than different. Okay, so now I'm going to add a script to this at the script. And this time we want creation, I forget to the creation folder. We've got two types of scripts. We've got auto objects Boehner and object shooter. So we want auto objects Bonner. So we're just going to grab that and just drag it on like we did before until here. And you can see that this appears, which is basically a box collider. And it's basically going to use this to spawn are objects. So in this area is going to spawn the objects. You can see some objects, some warnings here because there's no prefab selected in here, so it doesn't know what to spawn. And so let's just go ahead and change the size of this. First of all, we can do that by changing the size of the box collider. So we're just going to change the width here and we're just changing x. Just make it a bit wider. Okay? And then I'm going to just add temporarily, I'm going to add this asteroid sprite. We're not going to use this, but we're going to use pre-fab when we make it. We'll just temporarily at this just so we can see how it works. So we'll just click on this little dot here. And we'll add the asteroid sprite. And I'll just move this asteroid. Decide here. And let's just press play. Just to remind you where is if I click on this, you can see over here, let's just move it up a bit and press play. Okay, so now you can see there's a bunch of asteroids appearing. And so the ANY options will coincide. There is. The images code to the spawner. You could say the integral here is the only option that we have got. This is the number of seconds every second that's going to be something spawned in this area. So what we'll do is we'll just move this out of you like here. So that when we move forward, it will just spawn in front of us so we won't see appearing for press play. And I'll just move forward. You can see that there's just BY asteroids appearing. Okay? But at the moment is not attached to the camera, so it's just appearing behind us. And so let me just attach that to the camera. So we'll have to do is parented. So just click and drag left mouse button to click and drag onto the camera. Okay? So remember this little square you're seeing here is the camera's point of view. So that's what you can see from the camera. And so it's just outside of the point of view of the camera. So now press play. You can see that there's going to be asteroids put down in front of us, but we won't see them up here. Okay? So now the moment we can actually collide with those guys and just try and client, you can see that it can't collide with us. And it's also drawing those on top. So the spaceship is on top. So let's put the asteroids on top. So we're going to select the asteroid sprite. Just go to the options for the asteroid in the sprite renderer. Okay, and remember the sorting layer here. Let's put it on the same sorting layer, the gameplay sorting layer. And I'm just going to increase this to one. Oops, just increase this to one and it should appear on top. Now. They'll go to narrow. It saves on top. All right, and then what we can do is make this collide. So in order to collide, it needs to have a collider. Big surprise that and basically the rigid body component in the spaceship doesn't mean that it can collide with anything. So this means it can move and it can respond to physics, but it can actually collide with anything. So we're going to have to add a collider to the player and to the asteroid. Okay, Let's select the player festival. So select spaceship at a component where this can add effects 2D. And we want a collider, which is the shape of the ship. Okay? So you want to basic shape that's going to roughly match your ships or a capsule collider is a good one to do. So let's just do a capsule collider 2D. Make sure you use a 2D collider, which is what we're doing at the moment is a 2D ships just come in here. So you can see is thus the collider. We can click on this to edit the shape of this, let's click and drag. And you can see it's actually a capsule. Oops. Come back here and just place that round edge there. So this is basically what the computer sees when it collides with an object. Okay? So this is, you need to make sure that this is fairly accurate. We'll give them a little bit of leeway with the with the wings. Okay, so now I'll just click on that. You can see when we created that there's loads of different shapes like circles and polygons. So the more complex the shape, the more calculations yesterday, but say better off staying with a box or a sphere, or a circle. And it's gonna be faster. Okay, so this capsule is faster than using a polygon shape. So now what we'll do is at the same thing to this asteroid sprite. So I'm just gonna go to Add Component and just double-click this here. Just go to Add Component and Physics 2D. And we want circle collider, okay? And that's just going to fit around them as fine. So now we should get some collisions. So let's have a look. So now you can save or scan on the world. The ship is rotating because it gets hit and then it will rotate around, which is not what we want. Okay? So what we should do now is actually stop this from rotating. So I'm going to select the spaceship and I'm going to just stop the directions. I forgot to the rigid body 2D and CO2 constraints here. You can turn off the rotation in the z direction, okay? Because this is a 2D thing, it's only got one direction, so the rotation in this direction. So if you turn that on, it's going to stop it from rotating. So you can just try that out. Specific stopping it now. Pretty cool. They've got some obstacles. Alright, so the last thing we need to do is we need to make it so that when it hits one of these explored. So we'll do that later. Ok, so what we need to do now is make sure that the player can die basically if so, it's not doing anything at the moment. So what we're gonna do is use one of the other scripts. So we'll say script conditions and condition collision, okay? So you've got different condition types here. You've got moving into an area so you can have a block like a big square. And if something goes in there, something can happen or you can have a collision and which is what we're going to have. Or you can have when you press a button, something happens. Okay, so let's just add the asteroid sprite here. And we'll add a collision condition to that. Okay? And so what this will do is when it collides with something, it's going to need to do something. Ok. So what we need to do is add an action for it to do. So at the moment, you can see there's no actions here, so it's not gonna do anything. So we'll have to add an action from the actions folder. And so things you can do is load the level again. You can turn on component on and off. You can teleport something that you can teleport. You can move an object from one place to another. You can have a dialogue, dialogue balloon open up. You can destroy an object. So there's lots of things you can do. So what we'll do is we'll make this reload the level. So basically you die. So we're just going to go to low level action and add that to this. So Asteroid, say LoadLevel and just drag it in here. So select the player and we have to add the action to that. So select spaceship. So let's add this action. I'm going to go to Add Component and. And I just started iliopsoas just having load. And you can see the low level action will come up. Click on that, and you can see it's over here. And this component as basically a few options, you can actually load up a scene. And so in this project there's all these scenes and you can load them up. And when you die, for example. So you can go back to a scene which is the highest score or the load level before it starts. Ok. So we're just gonna reload the level, so it just restart if you died. And then in here you just have to pick that. So you have to click on this little dot and then click on asteroid, which is the name of the object. And then it should pick up the action that's attached to that. Okay, so now, so we added this condition collision stripped, and we added the low-level action, this load level action. So now when it collides with something, it should basically restart. So let's just press play and die. And there we go. So next restarted from there, yeah, okay. So we can adjust this later to edit explosion or whatever. But basically that's working now. And one last thing we have to do is make sure that these things die after a certain amount of time. So if I press play, you're going to see that we basically had every time as long as this thing is. The longer discussion goes on, the longer you're playing, the number of seconds is playing, the more asteroid you can have. And this is basically going to use up memory even though it's off the screen. So what we need to do is we need to kill these after a certain number of seconds. So I'll do is create an, add another scripts. So you got to script guy to destruction, and we've got this timed self destruction. So you gotta click on here. And we're just going to add that to here. Okay? And then now we can type in the number of seconds we want before it explodes. So just changes to maybe two seconds or maybe three seconds. Actually. Just gotta make sure that it's off the screen. So I should press play. It's just way here. Omega. So now they disappear after a certain number of seconds. We can adjust that later if it's not too, if it's not long enough, for example, ok, so now what we can do is create a prefab out of this. So the prefab is basically going to save all these settings that we've added, all these components that we've added. And then we can use that. That's pretty straightforward. We just have to do is drag it into this asset's area. So there's already a Prefabs folder, so let's just go into their click on there and then we'll add this to their. So I will just drag this in here. And there's our prefab. And then in our spawner, let's just pick that Prefab. Now it's already changed to automatically, so that's great. So now if we press play, these things should carry on. And we go. And let's get rid of this asteroid from here. Because at the moment is basically destroying this original asteroid and then it's not spawning anymore. So let's just delete that and go back to the spawner. And then just drag and drop this in here. Ok, and there we go. So now should carry on spawning. There we go, that's better. So before just so you understand, the asteroid here was destroying itself after three seconds. And then the spawner script had nothing to spawn because there's nothing that, so basically he didn't know what today. So that's why we pick the prefab in the, in this area here. In this lesson, we set up an asteroid spawner so that we can spawn some obstacles that would kill us if we touch it. 10. 10 make asteroid prefab variations: In this lesson, we're going to adjust our prefabs and make some variations again. So just a quick word on prefabs. If you look at down here in the prefabs folder, you can see the icon here. So this is what normally looks like and this is what it looks like if it's a sprite. So in this case we've got sprites, so it's got a picture of it. But generally if is a 3D object is going to look like this. And you can see that it's saved all of the components that we've added to this, so it saves all that stuff. And if you add this to the scene, you can see that it's blue and shows that it's an prefab. And then necessarily one of the main reasons you use a prefab is because if you put another one in here and just move it aside, you can basically change one of them and both of those will change. So for example, let's say we decided we wanted to make this smaller. We could take a scale and scale this down. And you can see this one doesn't change. But if I click on this upper area here where it says Prefab, click on apply. It's going to apply that change to the rest of the prefabs in the scene. So now you can see that that has changed as well. So that's really handy obviously, if you're in your scenes and you're laying out the objects in the background or whatever, paddies and different things. You can use this and change one of them and mood changes. Well, let's just go ahead and make a couple of copies of this. So I'm just going to give it to these guys. And then I'm going to duplicate this twice. So I'm just gonna go to replicate and duplicate again. Okay, so we've got to these, and I'm gonna call this one medium, S1 over large. I can spell it. And then this one will be small. So this is just to add some variation. Okay, so we'll take these and we'll train them in a scene so we can see them. So I'm just going to hold down shift and select all of those and bring them in and just move them to decide. Ok, so that's the relative sizes. So let's just take a large one and gather up like a big just make the small one smaller. Say well we can also do is make these rotate automatically. So let's go ahead and add a auto rotation script to this. So this is in the scripts and movement. And you can see we've got this auto rotation. So it's pretty simple script. It will basically rotate it a certain number of degrees per second. So let's go ahead and grab all these guys in the editor here. And then I'm just going to drag this on here and click on continue. Okay, so now we've got this auto rotation script. Let's have a play this and you'll see that you should see that falling down just as we did before. Because what this does is this will add a Rigid Body 2D to this, just like we did with the ship. And that means that it's going to fall down based on gravity. So let's just go ahead and make that 0. Remember I'm selecting all of these at the same time. So I'm selecting some, applying this to all of these at the same time. And then let's press play. And I can see that rotating. So let's just change this so that they don't rotate at the same speed. So I'll just have a couple of these rotating in a different direction. Let's just look at the script here. If you look at the script, you can see it's got this rotation attribute. This is the number of degrees. If you use a minus number, it's going to rotate in the opposite direction. And you also get a preview here with this green kind of gizmo here. So let's go ahead and make one of these going the other way. So I'm just going to change this to, I'm gonna make the small one faster. There's an elif and five. This is live, changed the medium one to a minus. And I'm going to say minus three. And this has made a large one minus one, so it's just slow. Okay? And this is press play. Today ego, you've got the different speeds there. So let's go ahead and apply these. So we need to apply this. All this stuff is not applied yet. You can see it's not blue. So you describe that, say apply. And I think you have to do these one at a time. Otherwise it doesn't come up, they gather, it doesn't matter. It doesn't come up here. So let's just do these one at a time. Apply. Apply. So when you click on Apply, obviously applies that to the actual prefab. They've got here because we're not using these. We're using these. Okay, so this is the saved versions. So let's go ahead and get rid of these now, this is just to see in the scene. Just go ahead and delete those. Just right-click to them. So asteroids porn on, we'll have one of these in here. If it's not in there, then just click and go to assets and then click on one of these. So I'm just going to click on the large one. So let's press play and see how this works. So remember we've got this spawner here in front of the camera, which we can't see here. But play. And what you see is they disappear as soon as this bond. Okay? So what's happening is it basically the asteroids are colliding with the spawn up. So this spawner Here is a collider. And so therefore, since they're born, they collide and then they get destroyed. So what we can do is we can actually tell the collision component to only collide with certain objects, which is really cool. So we can just come in here and grab all these at the same time. And then we can just take this collision condition script and we added, and we can change this to filter by tag. So we turn this on. We can actually add a tag to an object and basically we can pick what this object should collide with. So in this case, it's going to check if it's the player, and then it will only collide with a plan. So let's go ahead and tag the player. So at the moment is going to be looking for something cool player. At the moment, our spaceship has not got anything, or sorry, I did that earlier. You shouldn't have that attacked, but this should not have anything tagged here. So we'll just change that to play. Okay? And now we should get. What we had before. And there we go. So now they're not disappearing. Okay, great. Alright, so now let's just duplicate this a couple of times. So it's going to typically this and move it up. And this will be for the medium. And then undef again. And then we'll create another one. Now if you are scripting this yourself, what you could do is actually create a section here where you basically have an array. And you can add multiple objects to this so you can pick randomly from the object pool and add those to the scene. But in this case, we're just going to work around that and just add three different spawners and it's the same thing. So the good thing about that is that we can actually pick different intervals for the different spawners. So we can have more large ones, for example, or more smaller ones. And you can pick that by changing the small spawn interval. Okay, so let's just go ahead and just these. So we'll just grab the first one here and pick the medium. And grab the last one. And pick the small. Ok. So now these three, these three objects are spawning different prefabs, D3 prefabs. So let's take a look. See the medium ones and this just press play and see whether the appearing on not. The other way. I think the medium one isn't as big as it should be safe. I grabbed this medium and just drag it in and just kind of scaling up a little bit because it's a bit too small. So just click apply and just get rid of it. Let's have a look. Okay, so what's happening is that these things for getting dragged along. So all these things are being spawned but actually getting pushed like this from my cursor in here. So they're getting pushed. And that's because the colliders are actually pushing them, say still colliding. And it's basically not allowing those things to pass through. So it's basically like a giant sled. So basically we'll need to just turn an attribute on the, if you just grab these guys, you can turn on this attribute called Is Trigger. And that's basically going to stop it from colliding. And it's just gonna say that it's just going to use it as a trigger. In this case, all this object is doing, this script is doing is using the area. And it's going to automatically kind of Spawn Objects in an area. And it's using this thing as the area. So isn't actually using it as a box collider really. So it doesn't matter if we change this to Is Trigger, is trigger will make sure that it doesn't collide. Ok, so now these things should not be getting dragged along. All this stuff is great because this is a typical stuff. This is all the basic stuff that you should know when you're using physics and Rigid Body 2D or 3D. In fact, even. So you can see now we've got loads of asteroids and spinning around. Okay, and we've got different medium, large, and small k and we should die if we hit these as well. Just check that, check paying a medium one as well. So that's all fine. So in this lesson we created some variations for our asteroid, and then we applied a couple of spawners to spawn those out. Let's save this file. Safety, safety. 11. 11 make a win condition: In this lesson, we'll adjust some gameplay elements. Okay, so what we're gonna do is make it that you can actually win. So what we're going to have is a condition area. And basically that will bring up a user interface element which tells you that if one, okay? So this pack, this Playground Project comes with this pre-fab, which you might have seen earlier, is user interface prefab. So if you just drag that into your scene, you'll see that you see this Health Bar and the score bar. Okay? So let's just turn this off for now and just got two steps here. I'm just going to turn that off. Okay, so these are different elements that make up the user interface. And I'll talk more about user interface elements a bit later. But in this case, just know that these are different bits that you can turn on and off. Okay? So we've got this wind panel and you can see you can turn it on and off. And so we're going to turn that on using our trigger. Okay, so lets just grab a new object. So we're just going to create, create empty. And that's just reset this reset position. And we bid up, okay, somewhere around here. And then we'll add a component and we're just going to call this the condition one. So condition and you wanna area, okay, by the way, in case you're wondering how these things are coming up is because the scripts are already in the Scripts folder and they've been compiled. So anything that's compiled and as hasn't got any areas will appear in the search bar. Okay, so if we go to area, we should get this. So you've got this box collider 2D, which is that little box over there. And we can make that bigger. So let's just make the width they go and maybe the height as well. Ok, so now when it passes over there, it's gonna do something, okay, you need to make sure if you look at this warning, it says you need to make sure that this is a trigger. So this isn't four colliding is just trigger. So we go to an OEM and it's going to basically work properly. Okay, so what do we want this to do? We want this to basically turn a game object on or off. So let's add the action to. Let's just add an action here. And then we need to add it as a components are just add component. I am just going to type in action. Okay? And then you should see a list of the actions. Will pick the on and off action. Okay, so now that, that's added, we can go ahead and pick that. So click on this and click on your game object. Let's name this. I'm just gonna call this, rename this, and right-click and rename when area. Okay, So this is the area that you go to when we pick this action to do so in this section, we can basically pick an object and it's going to trigger this little thing, this little tick box to be on or off. So it's going to make an active or non-active. So let's just pick the wind panel that we just looked up. So just click here and we'll go to the wind panel. Okay? And just double-click it. And now that it's picked, and let's just have a look at if that works, so that should be fine. So let's press play. Just cannot get through this without getting hit. Okay. And another thing is that basically I don't have to go forward. So at the moment, are not forced to go forward. And that's another game play thing, which is not very good. So let's just turn this off for a second. And we're going to add a 2to move component to this ship, okay, so your player has to be forward. So just grab this spaceship and we'll add a component. And we'll just call this auto move. And you can see there's the alternative script. And you can add this to your bodies as well as your, your asteroids and your ships and other things as well. And we'll have a look at that a bit later. But basically, this thing is going to move it in the x or the y direction or both. And if you've rotated it, you can use a relative location as well. So if you rotated it going diagonally, it will move diagonally. For example, if you've got this tick box on. So we're just going to change this to 0 and we want it to go upwards. So remember what we said, y is up in the upper direction. We're just going to change this to ten. Remember this will apply a force to the Rigid Body 2D component that we added. So we need to have a quite strong because we've got a quite high numbers in terms of the Fourth Amendment. So in terms of the speed that we added, and if you remember, the move with arrows, we've got the speed happens up to speed on five, so it needs to override that. So let's just press play. Okay, so now we are moving forward and we have to go forward. So I'm just going towards my wind box here. Long enough they will die. That's another thing that we have to change. Doing this with my left hand here. That's Mike's case anyway. Critical. There we go. We have one and you can say that it carries on until we hit something, ok. So that's another problem. So let's make these last longer first MOOC. So let's grab these asteroids prefabs and just remember the thing that makes it die is this timed self destruction. Let's just double that to six. So I don't know, I straightaway. And then let's go ahead and add another area here. Okay, so we're going to add a duplicate this. Okay, and I'm just going to remove this on, off action and just rename this strain line is 2. Third seeing. Okay? And we can move this further up. So we can move it like here. And that's basically going to trigger because going to carry on living forward. So it's going to basically turn on the UN and then it's going to go into there and now reload the level. Okay? So otherwise it just carries on and you can't do anything, so you don't want that. Okay, so let's just change this to this load C1. And we're going to remove the on off action. So remove components and then add component, and we want to just type in action here. We went to reload the level, so alert level action. Okay, and we'll pick the load seen pave object. Okay, so that should work and let's just check it out. If you want to, you can bring those closer to you to say you don't have to go through this whole level just to see if it works. Shouldn't take too long. And it's restarted prelim. So that's a bit short. Let me just move this little bit this way. So now we can win. That's good and also weak. What we can do now is actually adjust where the player can move. So at the moment, if we press play, if I go to the left, just carry on going to the left and just go wherever. And I've run out of space. Ok, so what I can do is change the background color festival. So this has changed its background color to if you select the camera, background here in the camera component changes to black. Okay, that will change background color to black. And then we can also change the collision. So we can actually add a collision in here. So let's add a game object. Create, create empty. I'm gonna call this All. And I'm going to add a 2D components. Let's just add a, I'm sorry, it's called a box collider. So Box Collider 2D. And there, this little square there. And you can see, and I'll just make that tall up so just change the y. You see it getting taller. And okay. And I'm just going to move this to if you look at this little lightning bolt type thing, just gonna move it to the sides of that like that. And then I'll just duplicate that and do the same thing on this side here and just test it. So the reason I'm doing that is so that it stops before I run out of the image that you can't duplicate this across and just toilet across if you want to make it wider. Just showing you how to kind of set up some limitations here. So if I go there now you can see it won't go through them because the word tiles, this is a little bit off there. So let's just adjust that spit triggered to say in this 2D mode and that just come into 3D mode here. Let's put up another one here. Let me just move this down as well. Plus like this guy. Let's check it out. If you only want this ship to move left and right, and you can do that in the ship control script. So if we go to the actual spaceship again and go to this move with arrows, and you can take trains movement to only horizontal, and it will only move left and right if you want that type of thing for your game, I'm going to leave it on all directions for now just because it's more flexible, but we can change it afterwards if you want to, if we decide that, okay, that's too much flexibility for them to be able to be forward and backwards and stuff like that. We should actually add one at the bottom as well because we should be able to go after this player if we press play. If I go backwards, yeah, I can't go out and play area. So we should add one at the bottom as well. So let's just add this, duplicate this. Let's rotate. It turns to 2D mode. It's going to rotate it around. So I've been 90 here. And just move this down. It doesn't matter if it's bigger. Smooth it quite close to it. Quite clusters ships so that it's doesn't get chance to move down. And there we go. Okay, so let's just save this here. So in this lesson, we set up our wind condition and we set up some limitations for where the player can move. 12. 12 create an enemy: In this lesson, we're going to make a bad guy. Okay, so let's go ahead and go to the Prefabs. And what we'll do is we'll use one of these guys and we'll modify it. And that's going to be alphas bad guy. So let's describe the medium one and just put introducing. Okay, just double-click that. There it is. And what we need to do is replace the sprite. So we just go to the sprite renderer. And this is the sprite that's being used. So you can click on the little dot and we can pick something from our scene, the assets, and this is our scene. So make sure you are in assets. And so we can scroll down to the spaceship that we've got here. And we'll just pick one of these body images here. So I'm just going to pick this red one here first one, especially for double-click that. And there we go. So let's have a look at the size and the moment is a little bit small. So scaled up, scrubbed scale to scale this to something like something a bit more menacing. Okay? So you can see this gizmo here is saying that it's going to rotate. So we didn't want it to rotate like that. And just randomly, so we're just going to get rid of the rotation script. Oh, component, Remove Component. Okay, and then what else do we need to this today? We need this to move by itself, so I'll just press play and see what it's doing. It's just that there is and it's not doing anything. So what we need to do is actually move around. So we can either use the auto move, which as you saw, can move from left to right or in a diagonal or whatever you want. We can actually animate this ourselves and have it going left and right and doing fancy things. Or we can actually turn on this one, the script, which basically it does a random motion. So I'm just going to add this one discrete because it's pretty cool. So I'm going to look at this directory and movement. And you can see we've got a wonder script. Okay? So it's just going to wonder around. So if we click on this guy and just drag this in. And you can see that whether you drag it from here or whether you add component and type in Wanda is the same thing. Does this have looked at this? So if we open this up, you can see that we've got the speed and how often it changes the direction, whether it will stay near where it started off, and also whether it's going to be orientated in the direction. So we don't want that to be on. Okay? And they also added a Rigid Body 2D here. So we just need to change that gravity scale to 0. I think we've already done that. Ok, so let's just press play and see where we got. Okay, so you can see it's moving around. So if I press play again, it should be moving in a different direction. Again, different direction. Okay? So let's just change this direction, change interval to a smaller value. So it keeps moving around and changing. So that keeps wandering around. So now you can see it's kind of changing direction, moving around like Scott way of life to it. Okay. Now this Rigid Body 2D component hasn't got any drag on it because we haven't added data. So if we select this guy, let's name this guy to this nameless, that guy. Okay, so I'm just gonna call this one does too. So I know that is the wandering one. We can create other variations if we need to. So bad by wonder. And then we're going to change the Rigid Body 2D and linear drag. You can just turn up a little bit. Let's just change this to like four. And press play. Obviously, if that's too high, is not gonna do anything. So just be wary of that. So that it's not doing anything. It's like it's not really doing much. So let's just change the speed to scale back the bad guy. And let's change his speed. Speed. Speed. Here we are five. Okay, and play. That's better. Okay? So it's very lively. There'll be a dangerous, okay. Let's just turn off the auto die for now, because what we can do is place these in the scene rather than spawning them. So we didn't have too many of them because we can strategically placed them where we want them to be in the same. So let's just go ahead and turn off the timed interval for now. We can just turn it off. And if you need to, you can turn it back on afterwards. So let's just move this to a better location. And they should interact with the asteroids. So should actually push the asteroids around so that suddenly they go. So that's pretty cool and you can see it's rotating itself as well, which is not very good. So let's just goes back to a rigid body 2D. Make sure you're on bad guy. And just make sure you've got constraints. Freeze rotation. That way. It won't rotate. You can have it rotate if you want to. But in this case I'm just going to have it like a Space Invaders type of thing. So that looks pretty good. It almost looks like chasing him. And you can't actually have him chase the ship as well. So that's another variation as well. We can actually have them follow the player, this one here for the player. But that might be a little bit hot. So we're just going to stick to this one for now. And I'll just duplicate this a few times in the scene. So dismissed round here and duplicate this and just press play. And it looks like his colliding with the wind collider. So it's triggering that. So that's good to see this. You can get some happy accident. Yeah, so that's a bug. So we just need to turn on the filter here by tag and make sure it's just to play a same with this one player. So I missed the bad guy can trigger the win condition. He wants to win himself. Alright, let's go. Let's break go. Oh, gigabyte hard now. Okay, there we go. So let's save this up. Okay, let's just make sure that the collision here is the right size because at the moment is way too big, so that's not fair. So let's just change this to the size of our character here, roughly, something like this. And then we're a k. So let me just say this. So in this lesson we set up our bad guy using the asteroid as a template. 13. 13 add the ability to shoot: In this lesson we're going to add the ability to shoot. Okay, so finally we are going to actually blow something up. So let's go ahead and make a bullet and say we're going to make a laser. And there's going to be in these sprites directory. So we go to space shooters. I mean the sprites directory, space shoot up. And then we copy this I earlier. This is the retro bullet. I'm just going to drag this in over here. Okay? And then I'm just going to move it to about here. Okay? And then duplicate it and move it across. And then I'm going to select those two. And let's scale these. And if you scale it by default, you can see it scales from the middle, which is the middle of those two objects. But if you click on this button here, it's going to scale from the pivot points of those two individual objects. So it's going to use the individual pivot points. So we can do that. And it's going to Scholars. Okay, so now let's create an empty game object. And this is going to be parented, these political to be parented to that. Okay, so let's create an empty object. Select these two held down shift, and we'll just drag that left mouse button, drag until you see the capsule around it and let go. And then you've got the laser here. So let's just rename this laser is an African lasers there. So now what we need to do is actually have this do something. So the way you do that is there's a script in the playground project called Creation object shoot up. Okay, so what that does is it takes a prefab and it will create it and shoot out. So what we can do is, first of all, let's create a prefab. So let's grab this guy. And we're going to add a bunch of components. So first of all, we needed to collide with stuff. So let's add a box collider, 2D. Let's make sure it's a 2D One. And then let's edit the size of that. You can see that it's basically carefully click on the little dots they, otherwise it goes away. If it does disappear, just press that button again and it will come back. Okay. So now we've got the collider that, so when that hit something that we can have something happened. So make it a bit too easy there. Okay? So now what we can do is add a condition node. So when this thing crashes into something, is going to destroy the object. Take that. It's OK. So collides with. So let's go add, and we're gonna add a condition type in condition whoops, condition and collision, condition collision. And then we want to add a action. So let's click on action. So Add Component, type in action. And we want the destroy action. Ok, so this is going to basically either destroy the object de, collides with or the object itself. So in other words, the laser. Okay, so we're going to need two of these because we want to do both of those things. We want to actually kill the battery and we also want to destroy the laser. If we don't destroy the laser is gonna go straight through. And that is going to carry on going until it hits something else. Which means that it's going to be pretty easy game basically. So we don't wanna do that. So let's add another one and component and destroy. So now we've got another one. So in the bottom one, just make sure you change this to this object. So we've got to destroy actions, this object and object that collided. Let's add these now to the condition. So we're just going to click on this twice 12. And then we can just left mouse button, drag this into here. Ok, and just make sure you click on the title. And then I can drag the in there until the first blue, and then you can crop it. Okay, so we've got those two actions in them, and let's make sure that they affect the right things. So if you were to play this right now, you could actually kill yourself because it's going to collide with the ship and it's going to destroy the ship. So we don't want to say we're going to add a tag and we're gonna change the tag to enemy. Okay, so anything that's tagged with enemy, it can destroy. So let's go ahead and change the enemy here. Change all these guys, select these guys and just change the tag to enemy. Ok, so now only those guys will be destroyed. Let's go to the Prefabs and change that over here as well. Change the tag too. Enemy there to say that if we use that in the future, it works. So that's all cool. So now we can see that we've added our condition here. Okay, and the other thing we need to add, let's just have a look at this festival. So let's just add the object shooter script to our ship. Ship. And this is leftover from something and it's practicing. Okay, so let me just add a component to the ship, which is going to be object shooter. There it is, object shooter. Okay. And then you can see a preview of which direction it's going to shoot. We don't want it to do that, so that looks a bit off. So we just needed to shoot in the direction of the y directions. I remember y is up, so the positive y direction. So let's just change this to 0. And you can see the icon changes. And then we can change the prefab. So there's no prefab selected. Remember to read these warnings because it actually tells you what to do. So it's just very easy when you, when you read these guys. So it says no prefab selected. So let's make prefab out this. Let's drag this laser into the Prefabs folder. So now we have our lasers prefab. We can select the spaceship and we are going to and our lasers to that. Okay? It says Don't forget to apply a Rigid Body 2D TO projectiles or they were moved. So remember earlier we added the box collider. So let's select this guy. We added a box collider, but we didn't add a Rigid Body 2D node, so it can't move without a Rigid Body 2D note. So Add Component, Rigid Body 2D. Ok. And remember earlier we had this, now it's going to basically fall down because of the gravity. So let's just change the gravity to 0. And let's not have the ability to rotate, so freeze rotation as well. Okay, and then that should be m. So let's just. And it's the space bar to actually shoot these things. Ok, so what you can see that it's basically the object is actually colliding with the ship. Okay? So it's actually because it's got collider and the ship's got collider is going to collide with it and the ship is able to rotate as well. So let's just turn this off for a second. It's always good to play your game and then you can see any, any problems with it. So at the moment, the spaceship is rotating, so let's freeze rotation. I'm sure it did that, but maybe I didn't freeze rotation. And then say can rotate and we need it to not collide with the ship. So how do we do that? So this is a new feature that we haven't seen yet, layers. So the latest feature we did look at this in terms of organization in the beginning. But what we can use this for is actually picking what can collide with what other objects. So what objects can collide with each other. Okay, so we're gonna create a new layer which I've already created here, which is called player. So I'll show you how to do that. Go to Edit plays. And just a layer nine here, just type in player. And then you've got a new layer, and these layers are already there. You're just giving them a name basically. So now we can add our ship and our lasers to the same layer. Ok, so let's grab the latest change layer to plan. Yes, change to children, and also do the same thing for the spaceship. And so we're gonna select that and change that to play it to yes. Ok, so now we can go into this section over here. If we go to Edit Project Settings, Physics, 2D, we've got this little thing which looks complicated, but it's actually very simple. What it means is that it's got all the layers listed on the top and the side here. And this basically this tick box means that they can collide with each other. So I've already done this. So this is what you are should look like. So basically, the player can collide with the player. So in this case, we don't want that. So if we turn that off, now the player cannot collide with the player, but it can collide with the enemy. Okay, so that's pretty cool. So now, hopefully it should work. Okay? Now I have to apply this as well. This is a prefab. So remember I didn't apply this. Click on apply. And that we should work. And that's not colliding with the object. So let's go ahead and get rid of this guy. Delete and press play again. It seems to be a bit off to the left. So let's just see. If we just drag this in k, That's the bullets this time and just move them across and see if that works. Press Play. Oh, we gotta apply. Apply. I spent a OK. So just make sure you move this ships to the correct position. So let's just see if these things work. So let's grab a bad guy here. There we go. So you can see as getting destroyed. So we're going to add an explosion in the next lesson. You can do that using your object shooter. So if you want the firing to be quicker, you can actually come in here and go to object shooter. And you can see the creation rate. You can turn that down. Let's just turn it down a little bit. And you can see, if I hold down spacebar, you can see it fires a lot quicker. So you can leave, I'll leave that for you to adjust. But in this case, you can see that it's pushing these asteroids, which is quite funny. But we're going to actually use this to destroy the asteroid. So let's go ahead and we could actually put the asteroids on a different layer so they wouldn't interact with those. But let's just go ahead and make these the enemy as well. So let's grab the asteroid prefabs. Select this sudden shift, select elements. And we'll just tag this with the enemy. And we should be able to plug those up to. Okay. So that's pretty cool. All right. Let's go ahead and get rid of the lasers out the scene here. Okay, so whenever you're lining up your prefabs, just make sure that your spaceship is at 000. Just make choice here. And you can just see where it is. And then you can drag this in and see where it lines up with that based on the position. And then you can have whatever you want and click on apply. So make sure you click on apply for all the objects underneath as well so that the effect size. So in this lesson, we've created lasers for especially. 14. 14 create explosions for the enemies: In this lesson, we're going to add explosions. So let's get to the sprites here. And we've got in the Space Shooter, we should have these explosions here, recruit explosion, stepping up. And what we're gonna do is create a sprite and an object that we can prefab and put into this spaceship, this bullet actually, we go to the Prefabs lasers and destroyed over here. We can put it over here so that when the laser hits something, it's going to create this object. And that's going to be the expression. So let's go ahead and grab the explosion. So I'm going to grab the first one here. And then I'm going to create an animation. So you want to create an animation, what you do is open up the window, animation window. Okay? And then you select your object, and then you click on Create. And this will create a Animator and an Animation. So an animation is called topped anime extension. So let's create this in the correct folder. So let's go to assets and thus create a new folder inside assets called this animations. Or animation if you want. And create OK. And I'm going to call this one explosion save. Ok, so that's the file saved. And basically what this will do is allow you to animate any property that you want. So if you turn this on, you can take as red and it's recording what you're doing. So it will automatically make an animation. So if you change one of these attributes, it's going to add two key frames. Let's just show you here. If I just change something like this, you can see it's going to add a keyframe and it's going to move the time slider along a VDS or left mouse button and drag. You've got the frames on the top, and these are the seconds or 1 second here. And so you can change the attribute hairless. Change this for example, and you can press play. Let's just zoom into this and the scene view and press play. And you can see it's actually moving. Okay, so I'm just going to delete that for now. So let's just stop this. So this is the play controls for that animation. Okay, so let's just go ahead and get rid of this here to remove properties using this little drop-down here, remove properties, okay? And we don't want to animate that serve as fine. So in this case, what we're doing is we're animating the actual images, okay, so the easiest way to do that is literally to track those images in. So what I'm going to do is just take all of these images, drag the when, and then you should have the animation. So if you press play, you should see the animation that especially going through those images. And it's gonna go through them pretty fast because there's only a few frames. So if we just zoom in here and get rid of the spaceship here, just hide this and press play. Again. You gotta select your, your explosion. In order to see the animation on a press play. And you'll see this animation. Okay, so what we'll do is just stop this. If you open this up, you can see the actual images, which is really nice. And you've actually, if you select your keys, you can mark each of these keys. They're just click and drag. And you'll select those keys and you can actually scale the amount of time that it takes. You can just scale this up so that it shows the image for more than one frame. So say something like this and press play. Okay, so that's better. That reads a little bit better. Okay? So you can set that to whatever you want in terms of the length. So this is the length of the animation. And then we can closest animation window. Okay, so that's the animation. And so what we can do is have a look at this one we play. If we press Play, you'll see that the animation plays automatically. Okay? And the reason for this is because what happened was when you created an animation, this animator controller was created, this is called an Animator component. And inside here you've got what's called an animator controller. Okay, so this is basically a state machine. If you double-click that. This is the file that was made here. And this the animator controller that I'm talking about, this is the thing that you're looking at here. And when you create the animation, you basically created this thing. And this is basically, it's quite advanced system. It means that you can basically transition from animation to animation based on these lines, these transitions, and these transitions are basically parameters. So these are numbers. So you can actually say, okay, the characters moving at a certain speed. So it's going to play this animation. If it's moving at this speed, is going to play this animation. So it's basically a state machine. So in this case, we don't need to know the advance properties of this, but basically this is the animation that you created, explosion, ok, you can see here. And so the default that we'll play is this animation. So whenever you create an animation, there's only one animation there, so that's going to be set as the default. So this is the animation. If you right-click, you can say set as default, but this is already done for you when you create it. Okay? So that's basically your animation. And inside there is the explosion animation that you created. This one here has been added to that, that particular animation where this stuff is designed for more advanced stuff. So we just want to play a simple animation. And in this case, I'm just wanted to show you what an animator controller is and also what the actual animation file is and why it's playing. Okay, so anyway, so this thing is playing. So now all we have to do is make a prefab out this. So let's just drag this into the prefab folder. Okay? And so now we can go to Ally ship and go to, sorry, not the ship. And we won't go to the lasers and go to the death effect for the object that collided. Metrics for the object that collided, actually, yes, because it doesn't matter. It could be in either one. And then we'll just drag this into the, okay, so now when it hits something, it's going to make one of these. And let's make sure that it destroys itself after a certain number of seconds. So let's go to the explosion and after is played, we don't really need it there, so we don't need anything building up in the otherwise we're gonna get explosion after explosion after explosion. Every time you kill something, you wanna create one of these objects. So you don't want that. So you wanna make sure that you clean up your garbage. So you need to make sure that you add a timed self-destruct. Okay? And let's just set this to the second case. It will kill itself off for a second. So we won't get a bunch of explosions here. Let's get rid of this thing here. Remove that explosion that, and let's press play. And they depend on the spaceship. There it is. Okay, cool. So now we have explosions. Obviously, we could have different explosions for the different types of destruction. And the way you do that is you need to have another condition node and you change it there. So for example, if I just show you here, in here, if you go to the condition node, sorry, no, in there in the laser. If you go to the destroy action here of this condition node, this is for the enemy, so you could make another one for the asteroid, for example. And then in the destroy action, you'd choose a different object again. So you can have multiple versions of this condition collision on the same object. So that's fine. So that rather than doing the destruction just with one. So they've got the same explosion, which is this one here. You can have different explosions and you can download effects from the asset store, and there's quite a few free ones as well. So if you type in effects into the Asset Store, you'll see plenty of particles or whatever. Sometimes we create particle effects. In this case, this is an animation for sprite. But sometimes you can actually create a particle system which is a little bit more computationally heavy. Shouldn't be too bad actually for, for a simple scenes. But you've got some example stuff on the Asset Store, which you can play with and you can basically instantiate that just the same way as you're doing with this. Okay, let's say this. So in this lesson we created our explosions. 15. 15 add sound effects: In this lesson, we're going to add some sound to our scene. So we're going to download some sound effects from the asset store. I've already downloaded these, but I'll just show you, if you click on this little button here, you see stuff that you've already purchased or downloaded. So if I discover that, so I've got this sci-fi music pack. It is all free Budweiser sci-fi music pack. And it's about 19 megabytes, says nothing small. And we've got this retro game sound effects pack as well. Okay, so you just type it in here. So just type in retro, For example. The facts and free. And there is, okay, so let me just import those. So I'm just gonna go to that and press Import urine will say download sums can say import. And we'll just import all of those is going to be in a folder called audio, which is fine. Say OK. All of those and import. These are WAV files, so dot wav files. Okay, so we've got this ODF folder here. And then I also get the music as well. So standard for my Downloads here. This is where you go if you want to import something that you've already downloaded, I've already downloaded this sci-fi music pack. I can press Import Now, just to import it. And then just import all of those and say, okay, so that's important now. So what we'll do is add, first of all, sound effects to our bullet. So remember the bullet is when it fires. So let's just go in here to the Prefabs and go to the lasers here keeps a bullet device actually lasers. And then I'm going to add a sound effect to this. So let's have a look at some of the sound effects. So let's have a look inside audio, retro games. And I've already had a look through some of these. You can have a look through and see which ones you think a kid. And I'm just going to get to the shoot folder and just go to one of these ones are believed. To listen to these. You can click on them and then use the preview here. You can press play. And you can also stop there for a second. You can also press this button for the looping. And you can turn autoplay on as well, which is good because if you see this check. So I'm gonna go with shift 21. Stenographers. They can shoot 21. And by the way, that's because auto plays on. Yeah. So if you press the autoplay, then it will automatically play. When you click on a sound effect and it tells you some information about the quality of this is a PTM file and its foot four Hertz, 44 thousand hertz. It's a mono file and its length. Ok. So let's go ahead and we're just going to click and drag this onto our prefab. So we just go to the prefab. I'll just drag it into the scene as just come in here, go to prefab and wherever the laser struggling to saying this is just so we can drag it. And then I'll go to the music, the chute directory, and dragging the shoot 21 onto this here. Okay, so you should have a say. Yes. Let's try that again. I'll just drag it onto the hierarchy here. Okay, are better. So now you can see we've got this component and that's called an audio source. Okay? So no audio sources, as the name implies, it's basically where some audio is going to come from. And you gotta play on awake, which is the default setting. And that means that it's going to, it's going to play soon as is created. So as soon as this laser is created, it's gonna play. So if we just I gave so it's gonna play once. Yeah. Okay. The reason we can hear this is because there's a listener in the camera. So there's cameras gone. Audio listener, if he didn't have an audio listener in the scene, then there's nothing to, to find this audio clip. So the distance settings, the 3D sound settings are based on where the camera is. So the camera has got the audio listener. So if the camera goes and close to something it's gonna get is gonna get louder and it's going to fade off as it goes away from it. In this case, we're just going to turn off the effect because we don't want it to be a 3D sound effect. It's just going to be a regular, regular effect. By the way, if you wanted that to be on, you just slide this up to 3D. So if you turn it slides up to 3D, then this stuff would take effect. This kind of distance will take effect, but in this case, we don't want that. So we turn a spatial blend of And that's fine. Okay, so now we've got our sound effect on our laser illustrious press play. And see if it works. We haven't applied it. Apply this, which is the prefab. Imply the prefab and then get rid of this. Okay, let's try that again. Okay. So now let's just add some explosion sounds as well. So let's go ahead and add the, I think it was in gas. One of these ones are quite interesting that there's one big explosion now. Because I'm going to do this one, gas releasing nine. And we'll add this to the explosion prefab. So let's go to the explosion prefab. Second prefabs here. And let's go to the explosion over here. Okay, and then I'm just going to click on lock so that it doesn't disappear. And I select something else. And we'll go back to the gas. And we want gas. That's one here. So I'll just drag that onto this explosion here. Let's look at the manual way of doing this. Add Component, Audio Source. And there is only a source. And then we can click in this audio clip. And we can pick our source service, say gas typing gas, releasing nine. We could click and drag this in any way, but just show you how to do that. So that's the manual way of doing that. And then let's make sure that everything 3D settings are off. Okay, special blend is off, that's fine. So that should be fine now. So now whenever this explosion is created, that sound effect will also play as well. So let's check this out. Okay, so let's add some music to this. So if I just create a new object, generally, if you want the music to be added, I make a new node for it just so you know where the music is. So I'm just gonna call this music. And then just to reset this, unlock this delegate, reset this position. So it's good idea to make sure it's in the middle of the scene. Just practice to do so. Make sure that you reset that even though it doesn't really matter in this case. And then we'll just go to some of these music files here, the music files or in its own folder, in the assets folder called sci-fi music pack light. And these are free samples provided by this person who made this and listen to this. And I think it was the 29 that was wanted. This one start slowly and then it kind of so let's add that to the same. We're just going to drag this on here. And then you've got these different settings on here like volume and pitch and stuff allows her that's just let's turn down the volume a little bit just so that it's in the background and see what that's like to increase that level. Okay, so now we've got our sound in there and we've got our music and sound effects and music. We could add that to other things if you wanted to say, I believe that's pretty straightforward, feel free to download your own sound effects. There's loads of free ones on the Asset Store ledge of nice sound effects, and just picked these two random ready. So if you want to have a look through, there's plenty of free packs that you can get on the Asset Store and some really good quality ones actually. Ok, let's save our scene. So in this lesson, we added sound and music to our thing. 16. 16 add enemy lasers: In this lesson, we're going to add shooting behavior to our enemies. Ok, so we, so now we are going to add the ability for the baddies to shoot. So let's go ahead and let's hide the spaceship. First of all, just going to turn this off. And then we'll go to prefabs and struggling the baddie. And this is just for reference so that we can actually put the bullets in the right place. So there's this, reset this. Okay, so now you can see it's in the middle of the scene. And then what we can do is use these lasers here and repurpose though. So let's track those in. Okay, and you can see that there ever here. And I've also had a little play with this. Let me just change this back to white. There we go. So now we've got these two bullets so you can see that they're facing the wrong direction. And there's two of them. I'm just going to have one coming out of the middle, kind of makes sense for this design. Let me just zoom out a little bit. So coming out of this mouth area here. And so let's just do that now. I'm just going to get rid of this second one here. Okay, but then in the middle, can 0 out the exhale, and let's rotate in the z direction and just move it down here. So that's where it will come out. Ok. So now let's just move this forward a little bit. Just so we can see this. Actually we can just hide the bad guy syllabus, just hide that guy. And so now what we need to do is adjust the behavior of this. So at the moment, we've got an object shooter script and that basically when you press a button there, the laser will be created and also a force will be applied to moves forward. In this case, we're not going to actually control this. Obviously this is a battery, so it's going to be controlling itself. So what we'll need to do is add a spawn up to the battery so that it spawns objects. And we're going to add water move to this laser here. So this laser, so we need to add auto move to this so it moves down automatically. So let's do that now. Or to move, okay? Let's just make this go downwards, so 0 minus one, okay? You can see the error and will adjust the speed in just a second. So let's just see that. Okay, that's fine. Let's press play and you can see how fast it goes down. And in fact, let's just check the rigid body as fine. Yeah. Okay. Let's just have a look in here. Just going to turn my gizmos stock. Gizmos doesn't matter. Ok, just deselect it as play. Okay, it's pretty slow and meet the ODA by the way. So it's pretty slow. So let's just change the speed here. So you can increase the number of slots exchanges to say eight and press play. It's probably a bit too fast. Half that to four. And you can test this while you're playing the game later, but just want to get an idea of what's going to be OK. That's about right. Okay, so we've got the speed and it's moving down. So what we need to do is let's change the look of this so that we know that it's from the baddie. So what we'll do is we'll tend to, so if you go to the bullet, it's got the sprite renderer component on there. And you've got this color attribute, which is basically something that can be multiplied with the image to tinted. So if you multiply another color with it, it's going to attend to that color. So let's just make it yellow. So let's have a look in here. Luckily, this has got white in it, so it's going to tint nicely. So we want more of a yellow than an orange. So just looking at this area and the saturated there doesn't have to be too accurate anyway. So there we go. So we got a different kind of look for that triggered, maybe just made saturated. Okay, so that looks different and you can maybe change the size of it if you want to. Maybe make it slightly bigger because they're only going to have one of these. Just maybe slightly bigger. Okay. And that should do. So let's just bring that. Yeah. So that's in the right position to as fine. Ok, so let's rename this enemy lasers. Okay? And then what we want to do is adjust this collision condition. So at the moment, if it hits an enemy, it's going to do all this stuff. So obviously we don't want that. We want it to destroy the player, so change that to play. So now if it hits a player, that is going to execute these actions. So let's have a look at the actions that it's going to execute. That's gonna object, that collided winter is going to destroy the ship, the bad, the player ship, and it's going to destroy itself. But we also need it to restart the level because then the ship is going to be destroyed and the level is not going to be restarted. So let's just add another component here. You just add one here. And then we can add a component for the action. Okay? And we want to load level. So reload level as one. So let's just drag this into the bottom. And that should work. Okay, so now we should be ready to create a prefab. So let's just drag this in. Okay, so now we've got our enemy laser. Pretty cool. Alright, let's see. It looks like I've adjusted my bullet here, so let me just change this as just experimenting. Okay, that's fine. Just as an update it. Okay, and then let's just. Apply a, let's get rid of this guy. So let's bring back our bad guy. So it's a good idea to do this at the origin just so that we can get better understanding of where things are going to be. So let's just add a empty object to this, and that's going to be the spawner. And then parent that to the bad guy. Okay, so that's where it's in the middle. Let's just call the spawner lasers. Okay, at a component and we want to photo objects born again. So now we can add our prefab to this. Let's click on this. Go to assets and we want the yellow laser, okay? And this is the spawning versus how often it's gotta fire, so we'll have to adjust that. And then, so let's check out the box collider here which has just been added. You can see it's quite big and you don't really want it to be spawning all over the place. So let's make this really small. So it just basically spawns from the middle of this. Okay, so that's pretty small. So now it's going to spawn in there. And let's make sure it's triggered as on because we don't want it to collide with anything. And, and so that's it. So let's check this out and see if it works. There's colliding with the enemy because this is a different laser. So let's change that. Remember this is on a different layer. So we will go to the Prefabs and go to our enemy laser. And you can see it's on the player layer. So we want it to be on MY layer. And so now we should be able to, and we haven't set that. So let's go to Actually let's just create a new one, full Pulitzer, this added layer and a laser. Okay, and then we'll add that to the enemy lays up. Just check that then. Yes, changing children. Okay. And then we can go to Edit Project Settings and physics 2D. And then we can set it here so the enemy laser does not want to collide with the enemy, okay? But it can collide with the enemy player and maybe not with itself as well. So there we go. Alright, let's have a look at that now. See if we've applied this. And the MAY laser says check this again. And is this an enemy? Let's have a look. So this is tagged as enemy, but it's doing the enemy layer. So let's just add it to the enemy layer. We've changed these ones are things that we haven't changed all these. And then we layer. Let's play. That's better. Okay, so we added that to the enemy layer so they works properly. And you can see that they are accumulating there, so we need them to destroy themselves. Otherwise, we get a whole load of lasers there and just wasting memory. So let's get rid of these after maybe five or six seconds. Say auto destruct or the time to self-destruct. So add component, timed self-destruct. And we want maybe six seconds. And bears play. Disappearing after a while. Maybe six seconds is too long. It's just changes to fall maybe. Okay? Alright, so now what we have to do is update our prefab. So if we select this guy, click on apply. We should have the prefab with this spawn, spawn a lasers at it. Okay, so let's get rid of these. Are the bad guys here that we've got and how seen we're gonna have to replace those with the pre-fab, which we should've done anyway, really. That way, if we can make a change then all of the magenta, so it's just one of them is already change because it was a prefab. But these ones haven't scared of those. Just come on or control D different places. Ok. So look, we got firing. So what they're doing is they're colliding with these asteroids. So let's add these asteroids to the enemy layer as well. So if we select these and go to enemy, play, spin up. So they shouldn't affect the asteroids. A little bit unfair that you can see lasers from far away. They can shoot lasers from far away. So maybe we should set the self-destruct a little bit earlier. So maybe it should be 1 second Maybe. Because if it's off the screen, you don't even notice that there's a body there. So my baby, unfair. So they've got short range attack. That's not too bad. Okay. So let's try this out with the spaceship and get rid of our spoiler here, our original one. Okay, and press play again. And that's pretty cool. So now they're firing. A little bit more tricky now. Okay, so I'm going to save the file, saves in. So in this lesson we set up the enemy so they could file. 17. 17 add animation to the player and enemies: In this lesson, we'll add some idle animations to our spaceship and our enemies. First of all, let's grab a character. So let's go to the special pair and are going to go to the animation window when the innovation. And let's create a new animation. So create, and again, let's make sure we put this in the right place animation and call this player idle. Safe. And several of the sprite say aka space shooter. And then we're going to just grab these four. Says these, actually it's not these ones, it's the first fall. So these okay. And we're going to track those end. So I'll just take these and drag them in here. Ok, and just spread this out and see how they look. Okay, so that's how it looks. Maybe just make it a little bit quicker. For second. Grab these guys and drag it. Ok, that's better. Okay, so it's just an idle animation and it just shows that the rockets are actually firing. So now that should play by default. Per press play go. Shooting volume is pretty high at the moment, so let's reduce that volume so it gets the prefabs and go to the laser here and Audio Source and just turn down the volume to half. And maybe the lasers as well for the player. Okay. And press play. Okay, so that's one. And then let's go ahead and add an animation to the bad guys. Well, sometimes it's MiSeq the sky and create an animations list, drag event, and care to the animation window. Create. And let's call this. Let's put this in the assets and animation window folder. And let's call this enemy idle. And save that. And let's drag in our images to sprites here, space shooter. And again, it's these first four here. So lets just grab this sudden shift and grab these four here. And then I'll just track them in. And just scale this out to ten frames as well. And see how that looks. And it's pretty cool. Okay, let's clean this up and press play. This dying straightaway. So let me just go to my bad guy here. Let me just apply these settings. Actually apply so that it's got this Animator component on all of these guys. So you should have an air gap. Okay, so let's get rid of this now and press play again. And then I've got an animation on number 17. So in this lesson, we applied idle animations to the ship and the enemies. 18. 18 make level 2: In this lesson, we're going to create a level two. So what we'll do is we're going to deprecate there were one and change some settings. So let's go to our scenes volume and space shooter. And we're just going to select this and press duplicate. So let's duplicate. And it's already going to rename it to do. And then what we'll do is in the wing area load seen is that we can set this to load our level space shooter. Now if you notice here, it doesn't actually appear. And that's because it's not in the build settings. Build settings where you tell unity which scenes are actually part of your game, because you can have multiple scenes in your project, but you don't have to use them in your actual game. So if you go to File, BuildSettings, up here is where the scenes are, okay, so all these things have already been added to be built. Okay, so when you press built to make a game standalone game, these things will be built. So what we want to do, the ones that are tektites, where we want to do is we want to add our new scenes here to this, to this section here again, so you can add the open sea and you can click on add. That's going to add space u 21. And you can also just drag in especially to two as well. Okay? So now those two are in there and just make sure that the text as well, and these are untapped because this is our game and these are not our game. So that's fine. We'll just close that up. And so now we should have space shooter wanted to here. So we want to load especially to two. So that's gonna load our second level. And so that's gonna take us to our second level. So let's just change the specialty to now. So we're going to go into space you to two. And let's just save this scene. File. Saves him. And you can see especially to one here and up here to say which one's which. Otherwise it's difficult to tell. So let's, I've now especially to two, just make sure it's especially to do that. So let's change the background so we can tell the difference. I'm going to go to my Textures folder. Go to this texture. And I'm going to right-click and say Reveal in, find out or Explorer if you're on a PC. And then this is the file here. So I'm gonna right-click and say Open With, and I'm going to open it in Photoshop. Ok, so you don't have to do this in Photoshop. You can do it in another program like critter or game. There is a two free versions. I'm just using Photoshop because I've got installed on this computer. And what we're gonna do is very common command which is called hue and saturation, which you should be able to access and Gimp and in critique as well. So we're just going to image adjustments here in saturation. And we're just going to change the color of this. So I'm just gonna make a kind of pink, pinky red. So let's just go over here just where changes I will have a little bit of orange or pink or red. So I've got it on 15, 8. Okay, so I'm gonna say, okay. And then I'm going to save this as, save as pink. Turn off layers and safe. Okay, so it should appear here in a minute. There we go. So now it's imported. You can also make sure it's a sprite. That's fine. So what we can do now is just replace the image inside of our backgrounds or go to background, grab all these in the same, at the same time. And that shift. And then we'll just pick these bright in here. Okay, so let's change some settings in here to make it harder. So what we can do is make these spaceship go faster. So let's change the spaceship. If you select spaceship here, you can go to the auto move and make it faster. So this is up to you how fast you make this, say 20. And let's play probably a bit too fast. So let's change this to 15. Okay, and in interchanges speed of your object shooter as well. Otherwise, it looks that way. It's where you're going faster than your bot. So if we press Play, going a bit faster, okay? And what we can do is actually add a variation of a baddie and make him follow you. So let's, rather than doing the one script, we can change it to have it actually follow you. So let's go to the Prefabs folder as dragon the bad guy. And we're going to remove the wanda script. So let's remove that. And we're going to add the follow, follow, follow plan. Okay, so it's going to target the player. And it's going to target player, player. Okay, so this is a speed that's gonna follow it. So let's try that out and let's save this as a new prefab. So I'm just going to put this in here. And let's rename this. Follow. Okay, and I'm just gonna move this over here and press Play. So what you have here is actually coming towards. So you can obviously adjust the speed of that and make it harder if you wanted to change the positioning of these atoms is going to remove my initial bad guy wonders and replace them with these. The bad guys. So just hit control D Combine Monday. And maybe Joe pattern like we did in the old games. Let's press play. Coming off trusts. So unnatural. So let's just move it around. Typically CAN control Day. And let's make sure these die after a while because the following keeps following so self-destructive. And I wanted to be in the wonder, I wanted to be in the fall I one. So I turn around and change that to eight seconds. And then let's and change the speed here for the follow speed, maybe 0.5. Slow that down to 0.1. And just make sure these are changing as well as play. Okay? So that's the second level. So you can obviously adjust these settings and makes us kind of not too difficult, but difficult enough. So you know, it's a new level. Let's just change the color of these bad guy follows just so the player knows that is a different color. So I'm going to do is just go to the sprites folder and K-vector space you to here. So I take this sprite sheet and do the same thing, revealing finder open with going to shop. And then zoom in here so you can see this. And then go to image adjustments here in saturation. And I'm just going to make it kind of turquoise and blue. Say, okay. And I'm gonna save as electro SpaceShipTwo. Save. Okay. And that should appear here in a minute. There is. Okay, so now we can come in here and set this to Sprite mode of multiple and Sprite editor. And click on slice. Okay, there we go. And I sliced up. There's an up. And now we can grab the images that we need. So I'm just going to go to this bad guy, follow characters, prefabs, and go to the bank. I follow here. And you just change the sprite up here. So let's just select a new sprite. And that should be enhanced aroma. And we go, so a scrubber these. Okay, and let's turn off the animator so you can apply an animation in the same way that you did before. I'm just going to turn this off. Just say doesn't play the animation because the animation is going to be with these red sprites. So that's not gonna work. So this is going to turn that off for now. And then let's press play. There we go. I just want to scale these as well. Just take this and strop and here I should just double-clicked and scale. And it's kinda up event. And we apply. Let's check it out. Okay, there we go. Bigger and bigger medicine. Now. Okay. So lets remove this one here. Today. The thing. Okay, so let's check this out in the space shooter one scene. So if we go to the same k2 specially to one, and let's go through this and see if it actually loads up level to this nauseam visas as an actual load. Alright. So in this lesson we set up a level two, and I'm just showing you the different things you can change to make multiple levels and how to join them up using the load level component. 19. 19 make a build of the game: In this lesson, we'll make a build of our game. To make a standalone version of this, we need to build it. And that's basically in the File Build Settings. Okay, as we saw earlier. And you can see there's a bunch of scenes here which can be built when you press build. So in here, we can actually just select this stuff, hold down shift, and select all the way down to the maze Level one. And just remove this from this section here, okay, because we don't want that in here. And over here you've got the number. They assigns each scene. And it's very important because 0 is the one that's gonna load initially. So make sure that your space shoe to one at 0. If not, you can just drag it. Okay? And you can change positions. So just make sure that spatial two wires on 0 so that it loads initially. And make sure both of these are ticked. Okay? So you've got the different platforms as let's say you're doing mobile or something, you would have to switch the ova and select that and first switch platform. But in this case what we're doing is PC. And so we've got this, this is all fine. And what we can do is check the place settings before we actually build a. So if you get to play settings, these are the main settings for your program. So you can type in the name of your company and the name of your app. So I'm just going to write a type of asteroid. Asteroid run. Let's just leave a space, how that actually capitalize on that. And we can put an icon in there. So this will appear inside your find a window. So we can go to select and you can pick whatever you like. You can pick an asteroid or the spaceship. Let's just pick the spaceship for now. If I can find it. It's actually a sprite. So let me do that. So I'll just pick an asteroid. Ok. And then you've got the cursor, which we didn't really need. This is for the cursor as you are looking at minus black cursor, you can change the de-focus or if you want to. And then inside here you got the resolution and presentation. So you've got some basic settings for the standalone version, whether you allow to resize it and stuff like that. So it's just basic settings and the different aspect ratios i supports. So what I'll do is I'm just going to leave us on the default and I'm going to build and run. So building on will obviously make it and then I run it as well. So I'm just gonna press that. And inside here, we want to create, this is our project. We want to create a build folder. So we've got two new folders and filled. So you'll be creating bills all the time when you're creating your games. And so it's best to keep them in a folder named them. So I'm just going to call this asteroid steroid V1 and safe. And it's gonna say missing project ID, and that's just because Unity services, but we don't actually need those in this case, Unity services, things like ads and analytics and things like that. So it's more advanced stuff. Say we didn't actually need this for this project. Do you want to continue? Yes. So that's going to go through and for bigger scenes, this will take a while, but you can see it did that pretty quickly and said build successful. And now it's asking me, this is what comes up when you, when you run your game. You don't have to have this come up by the way. You can know you can set that in your, in your project settings, which I just showed you. And then you can crick click Play. And then you've got the standalone version. Ok, I'm just going to come out of that as press control tab that just to come out that you can press alt F for on, on the PC. Just close that down as well, is still open here. So let me just close this up. You can see the icon at the bottom that unless you can say that, let me bring up my finder window here and go to my bills. So you can see here, let's make this bigger. You've got the icon now, which is pretty cool. And so that's how you create a build of your stand-alone build. And let's say a big guys. Come in here. You can see it's 56 Meg, okay, so that's how big the game is. Obviously, we could optimize that. In this case, we haven't removed anything that we don't need. So it's pretty straightforward. So if you look at those Player Settings again, by the way, this place settings button, you can go from getting from Edit, Project Settings and play settings here as well. Okay, so over here it says display resolution dialogue. So if you don't want that to display, you can just disable that or hidden by default. And if he's hidden by default, and someone who, if they pressed the Alt key while starting a, will bring up that menu. Otherwise they will just be hidden. So you can turn that off there. Okay, so in this lesson, we learned how to create a standalone build for our game. 20. 20 add a start scene to the game: In this lesson, we're going to make a start screen for our game. So what we're going to do is duplicate. One of the things is I'm just going to duplicate space shooter one. So right-click or go to Edit, Duplicate. And I'm just going to rename that to 0-0. Just tidy and that's the first thing that's going to come up. Okay, so now what we'll do is just while we're here, I will just go to the build settings and just add this into the build settings, okay, and just make it the first thing seen 0, OK, you've actually seen 000. So now when you build this, this is going to be the first scene that starts up. So that's what we want to just close up, right? So let's open this up. Double-click that. And here we go. So we've got this guy and what we need to do is just delete everything. Well, most things, and we're just going to keep the stuff that we need. So we just want the camera and the background and everything else we can get rid of. So we'll just grab everything else. And I'll just right click and press Delete. And then in the main camera, we've also got the spawners, which we don't want. Ok, so we've got these three. You just want to get rid of those. So we just want this blank screen here. So what we're going to have is a title called Asteroid R1. And then we're going to have a little bit of writing here saying press space. So we're just going to have those things and when you press the space bar, it's going to load up the other scene. So we're gonna take a look at the UI elements in a bit more detail, the text element to be specific. So let's go to Create and UI and text. Okay, it goes to do that from the gameObject menu here. So let's just press the text here. What you get is this canvas object text and this event system. So this event system is something that we don't need. This is basically something that takes in input from a device. So mostly by default with a mouse or the keyboard. And it will take that, listen for those events and then do something if that happens and pass on those events, two buttons for example. So we don't really need that in this example, so I'm just gonna delete that. So we're left with our canvas and our text. So if you just double-click this, you can see this is the canvas. And the canvas is the size of your window here. So it's going to stretch to the size of your windows. If I make this smaller, you can see that that is actually going to resize. Okay, so it's exactly the same size as that. So one unit in here is one pixel here. So basically you're going to see a giant writing here in a minute. And that's basically how the default mode of overlay works. So there's three different modes in this canvas. There's screen space I, screen space, camera, and workspace. So overlay will basically take whatever you type in here. Let's just type in something in the text here. If you go to the text, just click on the text and let's reset this. So just click over here. And to say reset, to say it goes into the middle here. So you see a bit of text there. Just zoom in here so you can see that there's a text there. So basically that's being drawn and then completely separate from the scene. And then it's over the top or overlaid on top of the scene. Okay? So that's the default mode. The second mode is camera. So if you just come into the canvas here, you can see the secondary school camera. And if we change it to camera, we can pick a camera. Just pick the main camera, ok, and then you've got a distance from the camera. So this is actually rendered in the scene. So now it disappears. As you can see. You can't see that Canvas anymore because it's actually down here. I have here. And it's rendered in the scene on top of everything else. And it's a distance of 100 to exactly match the size of the cameras view. Ceo stayed the same size and we'll talk about size in just a second. But basically it will be rendered through the cameras. So if you've got any objects that are in front of a new kind of, they will cover up the text and things like that, okay, but it will stay in the same place. The third mode is a 3D mode. And a 3D mode is basically it just looks like a 3D objects or let me just show you the help here. So you've got overlay screen space camera, which is related to the camera. So if you've got objects as they're gonna render on top of the, the d-y. And then you've got world space, which is basically an object. And this is great for VR projects where you want a menu in VR. And so you can look around and you can look at different buttons and precedent. Okay, so that's just a quick overview of the canvas is. And so let's just have a look at this text object. Let's type in our, US just rename this festival. We're gonna call this asteroid run. Okay? And I must put the wrong about half. Okay? And we'll type in the text section. We can type in asteroids. So that's the actual texts that will show up. Type in asteroid run capital a. Okay, so you can see they're barely said. Let's just make this brightest. I'm just going to click in here. And you can actually, actually, if you don't have to click in there, you can click on the icon here and just pick a color of hair if you want. Okay, and then maybe just make this a bit brighter. So that's just desaturated that make it appear brighter. Okay, make sure your canvas is on overlap, otherwise I'm just going to turn it back to overlay. Okay, so we've got this stuff's double-click this and we go. So now what you can do in the text here. Let's have a look at this. So we've got the standard stuff that we generally have with texts. We've got things like, is it in the center? So that's just central line this. And we've got different things about what happens to the writing as overflows, as it runs out of space. So we've got different options here, but let's just change the font festival. So I've downloaded a font from a website. So let's just have a look at this. So let's go to figure into Google and type in sci-fi font free. You should get to this one hundred, ten hundred and one fonts.com, which is really cool. So you can come in there and you've got a bunch of different fonts here. And you can have a look through these and see which ones you want to use. I've just used this one here, 0 id. And so I've just pressed download here, again here. So you can see download and let me just make this slightly smaller. So there is an took on that to unzip it. And there's the folder. So you distract this folder into your font folder. We've only got font folder. If you don't have one, you can create one. I would recommend that you create one. And so let me just track that in. Okay, so it's in here. So now we should be able to pick that as a font. So if you click on the font section here, you can click on this. So now we've got this cool looking font, and now we can make the size begun. So we've got the font-size. Yeah, so let's make this bigger. But you can see it's kind of fitting inside an area. And the area is this little square here. Zoom in here. So you can see this little square here. And that's the area that it's kind of fitting inside. So if you click on this button here, you'll see that more clearly. This button here is for the resizing of a UI elements. So it's called the rect tool. And you can sort of drag these blue dots to resize stuff. But we're just gonna do this evenly. So we're gonna do this stuff over here. So I've reset that is why I recommend that you do. And then we can change the size. So you've got the width and the height. So let's change the width and you can hover over the name. You can left mouse button in there and just drag, and then let's just drag this out, just make it wider. Okay? And we're gonna move this up so that we've got the position now. So this is the position x and the position y. So let's just move this up. Okay, not too far. And let's make it bigger. And then you can change the size is changed again. And what I'll do is I'll press return. So let's just have this and just make this flipping a here. Okay, so press return there so that it's on the second line here. So that looks pretty cool and it's maybe bring it up a little bit. Okay, so you can adjust that to wherever you want. And let me just make this a bit whiter. Okay? All right, so let's have a look at these, some of these parameters. So this thing here is where you want this to be in on the screen. So you can actually, by default, if you click in there, you can see it's set to the middle, so is set to the center and the middle. So if I were to make this a different size, you can see that it's staying for Lego in the middle. Okay? If you wanted to stay on the left here, you click on that. You can see it's going to stay on that side now. It's actually sticking to the, to the left there. Okay, so this is basically your anchors and this is the way to. Set it into a specific position so you can click here and put it in the middle. We just want it in the middle. That's fine. So if it resizes, it's just going to re-size nicely, okay? And so the other thing you can do is change the anchors for that. So you've got the anchors inside here. And that's what these little triangles are here. So you can actually drag those out. Okay? And if you want to have a little bit of space, a little bit of a margin in-between here. So as it gets to the edge, it leaves that margin. You can actually drag these out. And you've got one for each corner. And you can see the dotted line there. And it gives you nice tips on how far is so you can get it the same number. So you can have 11 on both side. And we're going to use this anyway, but I'm just showing you as an example. So we've got 11% on either side. So now if I resize this, you can see that basically will keep that text inside the margin. Okay? So inside that Rect Transform. Okay, and let's just change this to the center here is, I'll just change that back to the center. And let me just put this position in the extract X in 0. So it's in the middle of the same. So hopefully that's clear. You can change where this text will resize to using this section here, okay, you can rotate and scale as well. I wouldn't recommend using the scale, just use the size and use the font size. So they, so now that we've got that, we can duplicate that and create another one. So let's duplicate this. And let's rename this to person dot first space. I'm just going to space because that's the firing button that we are going to use. So we'll just use that. So make sure you've clicked on that one and we'll just rename this text to press space. Okay? And smooth the stem position in Neves, position in the y-direction. Ok, and we want this to be smaller. So let's change the font size. So remember this fault will be fit into this square. Ok, so you can see that as I get, make this smaller, it's going to try and make this big excuse me, it makes it fit into the area. Okay. So let's just make that smaller. And I'm just gonna change the color. Make it white. Almost white, just so it stands out them all. Okay. And we can make the smaller if we wanted to, but we don't need to. And that's fine. So we've got that as our press space bar. So now what we can do is make some behavior in this so that it actually does something. So let's go ahead and we can have this anywhere, but I'm just going to add it to this canvas and add a component. Let's add a condition. We've added plenty of these, of course, condition keypress and it's already set to space bar. So that's fine. And what we'll do is add a event. So action type in action and we want LoadLevel action. And we want to load the space shoe to one. Okay? So that's going to happen when we press Space-bar. So let's add this. Make sure you add this. Always forget to do this. So press plus and then drag that in. So now that's done. And then you can check it. Press Play OK. Spacebar, and then it's done. So it's a bit quiet when we've manifest startup this game, let me just make this a little bit lower and a little bit bigger. Just a tiny bit. Okay, so let's just make some sound in here. So let's grab a, another sound sci-fi music pack. And it's going to grab this ambient one. And another way of doing this is just dragging directly into sin. You can create a quickly doing that method. So you just drag it straight into here. And it's gonna create a game object, and it's going to call it the name of the file and add an audio source to that. So that's a quick way of doing it. So that's our ambient music. And then let's just turn this down a little bit. I want it to be too loud. And then we're going to add a button press sounds so that when we press space bar, it gives you a little bit of sound. Ok, so I've just looked at a couple of these in here. So let's look at robot over the sounds festival audio. Audio. And I think it's in robot. This one. Yeah, that's pretty good. Robot five. So I'm just going to drag and robot five. So you can see is renamed itself to rebel five. And that's going to play automatically. We're just gonna turn that off. Okay? And we're going to add in the condition that we've created on this canvas, we're going to add a, another action. So we're just going to add component and we went on an off action. So click on that. And we want to pick our robot five. There is. You can drag it in as well if you want to. And then that's going to turn it on when it, when you press Space parser, let's press the plus. And I'm just gonna put that in the top here, just so happens first. And then hopefully that should happen straightway. So let's press play music. And then you press space bar this dots. 21. 21 add animation to the start screen: In this lesson, we'll add some animation to our start screen. So let's make this a bit more dynamic by adding some animation. I'm going to get a window and animation and describe this. Let's just talk this in here is where you can get to it nice and easily. And I'm just gonna say that layer actually just say layout, call it whatever Save. And now what we're going to do is select the asteroid run text, okay? And we'll just click on Create. And then we have to give this a location just as we did before. So Animation, and we're going to call this start an unsafe. Okay, so now we have this section here. So what we can do is we can press record and we can change anything on here and it will animate so you can do whatever you like. What I'm going to do is scale up this guy. So I'm gonna scale it from 0 to one. And so it just looks like a zooming in. So let's turn on autarky. So click on this red dot to turn on autarky. You know, it's gone its own when this stuff goes right here. So we're frame 0 here. You can go to different frames here. So you can see the current frame down here. So let's change this to 0, make sure it's on 0. And then we're going to set a key unnecessary will just change all these scale values to 0. Okay? Make sure you change all of them. And then we'll automatically set a key there, by the way. And so now we can go down to the maybe two seconds. Let's use a mouse will hear just zoom out and Karen to two seconds here. And I'm going to change this back to one. Ok, so now see that coming. And for some reason I couldn't see my keys. They are the marquee ever than they are there. So you should see these these keys have for some reason. I'm not saying that in my view. Not going to worry about that too much. They are there. So you've got one here and one here. And these are the values that you're animating k, So you can actually see them changing. And you can also type in a number that if you wanted to just type it in manually, type in 000, or you wanted to adjust that. You can also use a slider there, okay. You can also press this button here to actually remove delete keys. He's me. And so you can adjust stuff like that as well. So we've got those two values. Let's press play. You can just press play here. Okay? So you can see it's slowing down as it comes in. Which is quite nice. And that's because of the curves. So if you look at the curves and press F to frame this up, you'll see that this, this is the curve of the values changing. So they're changing from 0 to one. But that's changing very slowly. And then they're going to speed up and then I'm going to slow down. You can adjust that if you want to. If you just want it to be just a constant value, you can make it linear if you wanted. So you just Maki over the keys. And you see the tangent here. So you can see the tangent is very difficult to say. Actually it's a line here. For some reason it's not showing, but it's a line here that you can see. And basically you can right-click on that and say left tangent. So this is the tangent here, this line. And to the left tangent you can say linear. So it's going to be just straight. And then you can also select the other side and say write tangent linear. And then you just call straight constant kind of scaling there. Okay? So I'm not going to have them just going to leave it on default, but just wanted to show you that you can actually change that. So I'm just gonna change that to clumped auto. And so here, clamped alter and that should sell it back. And so that's made into a flat tangent. So at ease in and ease out. Alright, that's nice. So what we also get if you press play on the actual game, I'm just going to turn on mute audio. You can say it carries on, keeps on doing it. We don't want that. We just wanted to play once and then stop. So let's sold out. So we can go to the object here, and you can see that it should be an Animator component on this. Now there is, and the Animator component has got an animator controller. So just double-click on that. So just to show you that again, double click on this gray thing here. And you get the animator here. And then you've got, you've got the animation here, which is the one that you made the start and end. So if you go inside there, you'll actually see the clip that you've chosen there. So if you double-click that, it's better than a hunt for this, this clip. Or if you double-click in there, you can see this is the area where you, where you turn off the looping. So you can take this off and it won't loop. Alternatively, you can get to the project window animation and then pick the animation that you created. So they started him and then just take it off there as well. Okay. So whatever you feel more comfortable with. And so now we should get a playing once and then they weren't pagan. Okay, there we go. So the other thing we can do is let's fade this up. So we're going to take this, press baseball, and we're going to animate the alpha value. And the alpha value is how see-through is. So in this color, if you click on the color, you've got this HSV, but you've also got how far. And so we can animate that. So let's create an animation first, just like we did previously. So let's go to animation and click, make sure you've selected the sky. And click on Create. And let's name this space bone horse. Whatever makes sense to you. Safe. Okay. And then we'll and they made this so we want this to happen after or maybe after a little while after this started. So we don't want this to happen at the same time. So let's go to here, let's get to a second n. And we're just going to set a key. So let's come in here. Click on the color and just, just the changes. We need to turn on autarky vests, that terminal Turkey. And then we'll just change it a little bit. I can just drag it and it will set a key. So if you set a key on a non, non-zero value, it will automatically put key and at 0, okay? So you see as a value here, you click on this button here just to get to the next key. You can see it's on one and then it's also a one there. So it's going to stay the same. And then while this is playing, and then what we'll do is change it. So let's zoom out here. Go to two seconds. You can see this here says two. So that's the second tier and the rest of these numbers are frames. And so let's just change this to, you can just change it here. Type in 0. If we went to the wrong way around to say, let's just 0.1. And we'll go back to this one and change this one to 0. And the other one to, actually, before we change this last one, let's just play this. And actually this might work better, so it's going to fade up and down. Okay? But we actually want this the other way around. So we want this to be start off faded, then turn on and turn off. Okay, so let's do that. Changes to 0. And it looks more like an arcade. Then if it turns on and off in the middle, we're going to turn it on and cut next keyframe and ever gonna tell it off. Okay, so I've let us clear if you get to the curves, you should see what I'm talking about is getting on and off. And there we go. By the way, if you select all these guys in here to get these blue lines and you can actually move them around to change the timing. So I'm just going to undo that. But it's pretty nice and easy to use. So you can see this now. Okay, there's the key now you can see it properly and there's the tangent. So you can actually change a tangent manually to adjust the animation if you want to. This also shows you the looping behavior and what we're going to do in the future as well. Okay, so let's go ahead and have a look at this compress plate. Ok. And by the way, if you want to see this all together, you have to press play. So let's press play so we can see this happening altogether. So this thing is gonna scale up. And then it's gonna flash. Let's just make sure that it's not on by default this checking us out. Yes, off by default. Seems to flash a little bit. Let's check this out. Let's try maximize on, play on this does. Okay, well, I'm gonna do is just drag those keys along a little bit, just so that they happen a bit later. So Marquis of these guys, and then click on one of the keys and you can see that the icon changes to that kind of cross icon. So that's changes to 1 second. And then press play. That's better. Okay, let's just changes, fade up to be a little bit quicker. So the fading up. Let's move these two keys closer. So when it fades up is it's a bit quicker. That's better. Okay. So you can adjust that to whatever you want. I'm going to leave it at that. And we're also going to put in some prefabs here. And let's put in some asteroids. Just ambient asteroid around here. Just so it looks nice. So let's zoom into the background here. And the square is where your cameras, just as you had before. So you can just drag in some asteroids wherever you want them. Okay? And what we're going to do is just select all those asteroids together. Then shift and select up together. And just turn off this timed self-destruct because we don't want that, because otherwise they'll disappear. And then let's check it out. There we go. There we go. Alright, so let's say the same. Okay, so in this lesson we created an animation for our start screen. 22. 22 add parallax and final touches: In this lesson, we're going to make some final adjustments to our game and add some parallax scrolling. First things first, let's make this parallax scrolling. And that's gonna make it look really cool because you're going to separate the foreground from the background. Okay, and it's a classic kind of look of these arcades of games. So let's have a look at the camera and then go to orthographic projection. We're gonna change this to perspective. Okay, so now it's going to change a little bit. Okay, so now we've actually caught a field of view. You just press the 2D button here and have a look. You can see now we have a field of view rather than just a box that we had before, right? So that means that we can judge distance. So if we push this background a little bit back, we're gonna see the parallax. Okay? So let's take this background, take the top node here, and let's move it. Not scale, move again. And let's move it back in the positive z direction. So this back there and you can see the looks Federal Way that maybe just change this to something like eight. Just looking at this here. Okay, and then let's have a look, press play. And I can see that we've got this cool Parallax effect where backgrounds separate. So let's make sure we've got enough background. Let me just the audio here. Let's make sure we've got enough background here. So if we go all the way over here, you can see it's black on this side here, here. And here is black as well. So let's scale up the background. So the background here, and rather than, rather than filing it more, we can scale it. Sellers scale is. And let's make sure that's in the center. Click on center here, and then scale up. Scale up by third. Let's see how that looks. Make sure that there's enough. Yeah. Okay, we can also adjust the field of view. So at the moment, it's pretty Boyd. So compared to our original game, you can see it's actually the, the ship is quite small because I feel the view is quite big. So if we go to the main camera and you've got this field of view, and it's the angle of view here is 60 degrees. So we can lower that to see less. So if we just load a little bit, maybe change it to around 50 is good. Say 50. And then should see less. There we go. Okay, and we need some more on the side here. So let's just take this background here. Take everything inside here, then Shift. And then let's move this to side into the middle. And then I'm just gonna duplicate that command date and just bring it over. Make sure you don't leave a gap. Otherwise, it's kind of a weird. There we go. So now we have much more background that play with. You probably won't see that, but just in case on a wide screen, you can do that. Okay, so we also got this problem where the, I think the bullets are too slow. So if we go forwards, we can sort of catch up to the pullets. So I think what we should do is I really had this ship move horizontally. So let's go to the spaceship. Go to the moon with arrows. And I'm going to change the direction too. Horizontal. Okay, So now economic we've left and right and economy of up and down. So you can't go faster. So let's see the speed of this. So now can't catch up to my bullets. Okay? And I think it's a little bit slow. Okay, so let's get rid of these and let's change the bullet speeds. So we go to the Prefabs folder and we change the lasers here and change the actually it's going to be in the object shooters says Not going to here, it's going to be in the spaceship. So we've got a spaceship and just change the object shooter, shoot speed. And let's just change that to ten. Press play. Spit out. So you can see a little bit better. And maybe just increase the speed a little bit just to make it a bit more exciting. So auto move. Let's change this to 15. So it's a little bit faster. Okay? The other thing we can do is change the bullets colliding with the enemy lasers. So at the moment, if you notice, if you go to an enemy laser, if you actually shoot an enemy laser, they will actually collide with it. Started to mega. They go, they can say that. So you can see it kind of goes backwards that, so we don't want these to collide with these enemy lasers. So let's have a look at this Prefab here. And you can see it's on the layer of player. So let's make a new layer. And we're going to call this player laser. Okay, and let's add that to the player laser layer. There we go. Yes. Alright, now let's change the settings. So go to Edit Project Settings, Physics 2D. And just like we did before, display laser does not want to collide with the enemy laser, so turn that off. But it can collide with the enemy, but not the player. So let's turn off the player. Play. It doesn't right now. Okay? So it's little things like this that you have to fix at the end and you have to sort of look out for them. Okay, so the other thing we can change is if we go to the edge of the play area, we get to this collider. But when we get to the collider, it kind of slows down the ship. As you can see, kind of the friction is set to be pretty high. Okay, so that's the friction that's causing that to slow down. So what you can do is change that. And that setting is basically inside a material. So if you go to the actual area here, let's have a little tidy up at this hierarchy here. So we've got our main background and user interface. These guys, these are the colliders. So let's create a new empty. I'm gonna call this colliders, because this game spawners call this colliders. And let's just get this when area and the walls and just put them in and okay. Okay. So there's my colliders and I'm just gonna make another one for the, for the enemies. And just put these in here. Okay, so now, so in the colliders, if we go to the wall here, we can see that it's got a material and the collider here in the box 2D collider is material. So we can actually create a new material and set some settings on that. So let's create a new physics material. So I'm gonna go over here and let's create a new folder. Always good to create a new folder because it's all organized then. Physics material. Physics material. There we go. Okay, so inside here, I'm going to right-click and go create physics material 2D. Okay, then I can say this is the icon for it. And let's just call this no friction man. Ok. So let's adjust this to friction of 0. Okay? And so now it should be very different. So let's grab the wall. All of these together. And we're just going to drag this in this section here and the material section. And we'll just press play. So now it doesn't affect it. Okay. Let's also changed our user interface to use our new font. So scattered to the wind panel. And let's turn this on and just to see it. And let's go inside here. Actually select the wind label and change the font to this new font here. And let's change the size. Lets call this level complete. So let's apply this Prefab here. Select the user interface and make sure you apply and applies it to the prefab. And remember, we've got another scene here, so we have to do that to the other scene as well. So we could do that manually like we just did, or if you just make pre-fabs out all this stuff so we can make our player into pre-fab, which is always a good idea. So let's drag out Player in here. Let's just call this player just so it's clear. And I'm going to drag this in. Okay? And then the, also the qualities we changed those drivers in. Okay, and that should do. Alright, so now let's save the scene. Okay? And then open up. There are two. Okay, so now it's open and then we can drag in our eye, we should end up with the cameras wireless. Let's just open up the camera. And let's do this with the students, with the background and the camera as well. So let's grab the background. And the camera. Okay, says the power pre-fabs. You can basically apply our settings across the border. So let's go to scenes. Go to shoot and safe. Okay, and now we want to get rid of this camera. Dragging out other common springing up here and dragging the background. Delay, this one. And change the texture here for these guys. There we go. So now we should have the parallax because we've changed the background on which ends the camera. So we should have the Parallax effect in this scene as well. And let's change the player settings which we tweet qubit. Just put this in here and this one. Okay? And everything else, this stuff here, we need to change as well. So when area, while the stuff we can delete. Okay. And then dragging our colliders, prefab him. Okay? And then let's just group this up, Create Empty, and call this enemies the bad guys here. Enemies. Spare none the parentals up. Okay, and let's check for splay. Let's just make sure that it's following the player here. Click here, and click here. We should be looking at the look at remember the null here. Okay? So I just disconnected the references there, and that's fine. It just got reconnect dies. And the bullet shouldn't be colliding prefabs. So they should all be fine. And then in this level, if you change the speed, you can change the speed to even higher number. So let's just change the speed here at 20 because this is supposed to be harder. Stay the same. So in this lesson, we made them final tweaks and added parallax to our game. 23. 23 make a 3d player: In this lesson, we'll start making our 3D version of this game. Okay, so we're gonna make a 2.5 D version which is basically going to use the same game mechanics and all the technical stuff of the 2D version, but the graphics are gonna be 3D. So let's copy this project. So let's close this up. Let's quit unity. Okay, and then I'm gonna take my playground project and I'm gonna duplicate it, say copy. And technocrats duplicate. Okay. And the reason I'm duplicating is because I don't want to adjust my original ones. I want to actually keep the original 2D version. And so this will just make things easier. So let's rename this 12 3D. So Playground project 3D. And then we can open up Unity and open. And so I'm just going to open up that 3D project. Okay, so it's exactly the same obviously. So what we're going to do is first of all, work with the player. So we're going to download a spaceship. So let's go to the asset store. And there's loads of 3D spaceships here. The Unity project, the space shooter Unity project that we saw earlier has got a spaceship in there as well. But just to make something a little bit different, NAS, search for something a bit more unique. So let's type in spaceship. And hopefully this will give you an idea of how flexible and useful the Asset Store is. You can change things around and make things your own. So let's have a look. We've got all of these which are free, so I just clicked on free here. So these rule of free spaceships and a 3D assets. So there's a bunch of models here, but I'm just going to use the star sparrow model, this one here, Screen1. So click on that. You can pick whatever you like. The thing to look at when you, when you look at these is the polygon count. So this is between seven hundred and fifty and two hundred and twenty triangles, which is depending on the different configurations. So this has got lots of different types of configurations for the same spaceship, which is pretty cool, and they'll come as prefabs. So you can just drag them in. And then you can flip through these images here as well. And if they've gone in videos or sometimes they have YouTube videos as well. And they sometimes have a Sketchfab limb. If you don't know what Sketchfab is, it's basically a place where you can upload models and see them. So if I click on this here, you bring up the Sketchfab website and then you can actually look at your model and spin around it using your left mouse button. So you can actually see the model and you can see in wireframe and different, different modes as well. So you can clamp is gonna close it up. So let's import this. I've already downloaded it, so I'm going to press Import. Yields will say download, so I'm just going to click on import. So we want all of this stuff and it's gonna go into the stars parallel, fold up. Always have looked at where it's gonna go so you can find it after you've imported it. Import. If you look down here, you can see it as 55 meg, Okay, and this is the, what is included in the package. So you can actually click through these and it will give you a preview of things that I can give you a preview of. So things like the material and some of the FBI axis, which is the file format for the actual models. So you've got the FBX, yeah, there's models that you can see. It comes in different modules. So you got the core, the engine, the plasma thrusters. You can make your own spaceships with these pots, which is really cool. Okay, so let's import this now. So we're just gonna go to the folder here, and we've got to start Sparrow here. So I'm going to grab the Prefabs folder. And then I'm just going to look at this. If you click on this, you'll see them. You can use your left mouse button inside here and drag around so you can actually see a model. So I'm just going to be using this one here, which is the stars per six just because it's got a similar kind of small area here. I don't want it to be too wide. So you can pick whichever one you want to. I'm just going to pick this one here. And then I'm going to drag that in. So let's drag it in. And then, because our players, let's go to the game view here. So we've got a player that's double-click on our player. So there's our Player sprite. And so what we can do is just drag it on to them. So it's parented to that. And then let's 0 out the position of this. Just, so this is the star's bearer. I'm just going to 0 that position. So it should be exactly where the, where the ship is. So recent that so now it's them. And so you can see that it's basically facing the four directions. So the zed direction, and it's facing that way. So what we need to do is we need to rotate this. So let's just rotate this in the x-direction. You can just check it by rotating and seeing which directions I wanted to point out Woodside minus 99 K. So now we've got the ship that let's go back to 2D mode. Make these icons disappear. And then let's have a look at the size of this scale is just going to bring it back a bit. Okay? And then you can have a look at the player. And inside there you've got the sprite renderer. So if you turn that off, the object would disappear. Okay, so this is what it was before and the sweat looks like now. Okay. So you can adjust the size of that depending on what you want for your game. And we can adjust this later if we need it, if it's too smaller, for example. But what we need to do is the important thing we need to do is adjust our collider so it matches the shape. So if we look at our collider, This is what it looks like. So this does not match the shape of this. So what we can do is we can use. Different collider for that. So let's have a look. So we can go to Add Component, Physics 2D. There has to be a physics 2D. And then we can choose something like a polygon polygon collider. Okay? And that's basically going to pour a polygon around the shape of this note here. So let's turn off the sprite and then we can adjust the shape so we can click on this thing here. And then you can, you can see a little dot there. Let me just zoom in here. So you see that dot there and that will allow you to change the shape of this. So let's just make this match the shape of this. And it doesn't have to be massively accurate, but just make it kind of fit round here. Okay? So something like that. And just make it more health. Alright, so now we have our custom polygon collider Hill, and we also need to get rid of this capsule collider. So I'm just going to turn this off and then we should be good to go. So now if I press Play, you can see I've got my 3D ship. And it doesn't look very 3D because we haven't got any lighting or anything in the scene at the moment, so we're going to adjust that in a minute. But first of all, let's apply a different material. So the material here is applied on a 3D object by selecting the material, selecting the object. And then you can see that we've got the shade applied. This is the shaded as applied, and these are the maps that are applied to that shader. So we've got the stars parish black shader applied, and it's got different shaders included with this pack. So we can actually choose the color that we want. So I don't want black because it's pretty a dog. So what I need is something a bit brighter. So I'm going to use red. So I can go into the Mesh Renderer component. So this is called a mesh renderer. And this is basically the thing that renders our polygon object here and makes it look 3D. So inside here you've got different attributes about the lighting and whether it cause shadows and stuff like that. But inside here you've got the materials and what material is applied. So this is where you'd go to actually change the material. So you come in here, you can click on the arrow here, and then you can pick another material that's in the scene. So new assets folder. So we've got red here and we've got different colors so you can pick whatever you like. I'm gonna pick this red because it's nice and bright. And so we should see this once we, you can see it's changed here. We should see this once we put some lighting in. So let's create some lights in here. So I'm going to go to create light and shade the different types of lights here you can see we've got directional point, spotlight an area. And these are the four different types of lights. These are the things that you do with probes and other lighting. So this stuff is the actual lights. These three are the only ones that can be used in real-time. So area light is just for baked lighting and begs lighting is where the lighting is precalculated before anything happens and it's baked into a map. And so we're not gonna use that in this case. So we're going to be using one of these. So let me just show you each of these. So if we're going to directional light, you can see this is the icon here. So with a direction would lie. It doesn't matter where it is. If I move this around, you can see lighting is not changing. The only thing that matters is this angle that we've got here. So we can rotate this and this is where the light will hit the objects. I watched the object. You can see that it's changing. So if I rotate it like this is going to come from the top priority law. This is going to come from the side, et cetera. Okay, so basically this is the same as having a son in there. The rays are parallel. They don't, they don't diverge. And the rays are parallel and it will basically hit every object in the scene. Okay, so this is good to light your scene because you can have one on one side and one on the other side. And it's going to cover all the angles. So with 3D lighting, you've got to make sure that the faces hit a light so you can see there's light coming down from here. It's going to hit these faces. And it's going to light up those faces. So these faces over here are not being hit by anything. So we need to have a light from this side and then all the faces are covered. And then we can make different colors for the different lights to make a little bit of variation between one-sided near the site. So the light, so I didn't oxide. So before we do that, let's just show you another couple of lights just before we go on to that. So if we select this guy, we can turn it off by just using the usual active button. And then we can go to create light, point light. And a point light is just from 1 in space. You can see here it shoots light from all round or zoom out. This is the gizmo. Anything inside here is a range, and you can see the range slider here. So you can actually slide that down. And this is what will be lit, okay? And so if I move this around to see where we are, so you can see it's next to it says not lighting up. Above it. You start to see some lighting and we just need to increase the intensity. So if you check this intensity and slide it up, you can see that again lighting here, okay. So you can put that in as well. Around. For each of these lights. They have a mode which is here. And you can either have a real-time mixed or baked. And this is how it responds to bake, to lighting. So we're going to be using real-time. So it's going to be calculating our shadows in real-time. And we're not going to be using baked. Okay? We also have the important parameter here of whether it cause shadows or not. So if you watch this, if I turn on hard shadows, it should show shadows here. And us to change our quality settings. So if I go to Edit Project Settings quality and changes to fantastic should make the shading better. So it's going to turn on more features. So let's just have a look at this now. If we move this around, you can see some shadows coming in that say that black thing, that that's a shadow. Pretty cool. You can have no shadows and that'll disappear. So that's the same for this directional light here we've got real-time shadows, we go intensity. And there's a common parameters here. So let's go ahead and look at the spotlight. Which is the final one. Study this and I'm gonna use this spotlight. And as the name implies, you can see it's a light and this is the penumbra. This is what's going to be lit. And let's just move this here and rotate it. Let's increase the intensity. And I can see it's being lit. Okay. And this is good for lighting areas with a nice gradient, very flexible. You can make this wider and anything within here will be lit. And this has got some fall off. So basically this is gonna be right over here and a docker over there. So if I bring it closer, it gets brighter. Okay. If I take, if otherwise is gonna get Dhaka says, a realistic fall off in terms of the brightness of the light. So let's get rid of this. And unless turn on the directional light. Okay, whoops. And zoom in here. And I'm gonna make this the key light. So I'll make this a little bit brighter. So be the main light. And then I'll duplicate this. Let's just be named as key. And duplicate code this one filter. And you can change the color by the way, in the color section here, I can click in here. And ten to if you want to. But I'm not gonna do that right now. Let me just change the fill here. So I'm going to rotate the film. And he's rotation here. And just use this to rotate, flips to the other angle here and rotate it slightly downwards. And let's turn this down. Okay, so this is just to fill light. So let's just write this slightly Dhaka. You can make this maybe, maybe one of these blue colors. And then you make it a bit more intense. And I was like it's being lit by that now. And let's give it a play. Okay, let's update our prefab and scattered player and apply. And then we should go to the Prefabs folder here you can see that it's updated here. Okay, so let's save this now. Same thing. In this lesson, we replaced our 2D player with a 3D plan. 24. 24 make 3d asteroids: In this lesson, we're going to create our 3D Asteroids. Say what we'll do is download our 3D asteroids from the space shooter project. So Guide to Asset Store downloads that you've already downloaded. And once it loads, there can come down to the Space Shooter per object somewhere here. And then I'll click on Import. And it's warning us that it's a complete project. So you gotta be careful with this. Make sure you don't impose your project settings or anything like that. So what we want to do is say none. And we're going to import in the complete folder. So if you just look at here, okay, so we don't want any of this. In a complete game section. We've got some prefabs. So these are the ones that have been setup. So we want the asteroids, okay? So these ones here, and we want the material, actually got materials and models. Let's just take these materials as well. The reason I'm importing these is because they have got some shaders applied. So we just got to make sure we import those otherwise, they will look very good. So we've already imported textures already, so that should be fine. So you can click on import. So let's have look at this as in the complete game folders we saw prefabs, and now you can see our prefabs here. Ok, so our 3D prefabs. So now let's set this up for our asteroids that we have already. So let's go to the prefab and let's track these guys in 2D mode here, the header, and then just drag in our other ones. So prefabs, trackers in. Okay, and I'm just gonna do the same thing that I did with the ship. I'm going to parent the parent up and then turn off the sprite and then make sure that the collider still matches. So let's do the first one to match this up here, parented up, and then this, reset this. So it should go straight to that. And then we can go in and adjust the So in the astroid. And this one is called alot of stuff added, which we don't need. So because this is a prefab, is actually got all this other stuff that we don't need. So it's called a capsule collider, which we don't need. Okay? And all the stuff other satisfying, this is the actual model. And then above that it's also got a rigid body and some scripts. And this is for the game, so we just remove those. We don't need those. We've got our own versions of those. And say that's fine now. And then what we can do is make sure the size is correct. And we can rotate this a little bit so we could make it look a bit more 3D by just moving and rotating it and scaling it to kind of match that footprint. So if you look on the asteroid here, let's just check the circle collider and just make sure that it's not too big. Otherwise, it's going to be unfair for the player to make sure it fits the 3D asteroid. And then you can turn off your sprite renderer there. Okay. You can change this to a capsule collider if you want to make it a bit more. Capsule Collider 2D, if you want to make it different. Okay, so that's about right. And then what I'll do is apply this now. So let's get the asteroid and click on apply. Now, settings are saved in our prefab. Let's just check that. You can say here. So let's check this out. Everything else should still work. So if I press Play, you can see we've got some 3D Asteroids still rotating as well. Ok. Let's watch that one. Can see it rotating. Okay, so let's do the same thing for the other two. So again, I'll describe Asteroid two into there. And then asteroid tree into their stay close together. And let's reset a transform so that will be made at the same time. And that's removed these components at the same time as well. And as I open this up and just remove the capsule collider. Okay, so now we have these two and so you can just adjust the shape of those. And the rotation of that is just like we did before. So let's grab this guy and rotate it. Scale it down a little bit. Okay, and then let's just check the actual collider. That looks fine. Just make it a little bit bigger. Okay, and then let's turn off the sprite renderer. Okay, so we've got that one done and just apply that. It saves it. And then let's go to the asteroid to here and do the same thing. Let's rotate this. Let me keep it a little bit more flat here. Okay, and check collider. Let's make that a little bit smaller. And then turn off the sprite renderer and apply the settings. Just check your pre-fab folder here. And these should all look like the 3D ones now. Alright, so let's have a look at this. The, the functionality should still be the same, should be able to crash into them. You should still be able to blow them up as you can. And it should still be rotating. They're a little bit bright, so maybe we can change the shader on these. So let's adjust the shader. Lets just have look in the materials folder. So let's go to materials, and this is the asteroid here, okay? And then the shader, you can basically multiply the color by another value, and this is the value here. So if you want to make it darker, you can click in here and actually just take the V value and just larry down. So if it's getting too let, we can just bring that down to say it looks a bit more realistic. And I'll do the same with this one. And this one is well, okay. And I might just turn up the lights a little bit. Let's just check the shader only ship here and go to the status bar. And you can just slide down the smoothness a little bit, just, just a little bit just to make it a little bit more because at the moment is very metallic, so it doesn't light up as much because we haven't got any reflections in that. So I'm just gonna make this a little bit less metallic. Ok? And if you want to, you can also increase the light a little bit. So let's take the fill light and increase that. Just so we can see the edge of the a bit better. And maybe even the key lights as well. It just got to be careful to balance the so that they don't get to overlay it. Lets us have a look at this. Okay? Alright, let's save our scene. In this lesson, we replaced our 2D asteroids with 3D Asteroids. 25. 25 make 3d enemies: In this lesson, we'll turn our enemies into 3D objects. So let's pick a spaceship. So I have typed in especially pair and a free. And we'll have a look at this UAV Trident. So I'm just going to select this. And it was quite alien like this and just download that. Okay, that's important everything. So I'm just going to click on import. And this has a couple of paint jobs. I think. You look down here, you see it's got this grey and green as well. And I think I'm gonna use this green because it's brighter and it looks more dangerous. So let's go into the folder. Uav Trident prefab, and drag it in its rotate this and Wallace less parent out first. So I need to grab one of these guys and parent up to there. And then reset the transform. And then let's just double-click this. And let's rotate this. So we want it to be the other way. Say we want minus 90. I guess I'm just going to scale this down. Let's check the collider now. So I'm gonna go to the bad guy. I've looked at the collider and you can see it's around that. And let's turn off the sprite here too, so it's clear to say, so that's the collider there. So let's just make this a little bit further back here. As tennis into a capsule actually. So I'm just going to add a physics 2D Capsule Collider 2D. And I'll get rid of the cycle. Added that first because otherwise some of the scripts complain that there's no collider. Nasa, I've added this in first and then you can get rid of the other one. So now we can adjust this little bit more flexible. And you can do what we did before with the spaceship. You can do polygon. But I'm just going to use a collider for this, the capsule collider. Okay, something like that. And then let's update this. Select the bad guy, click on apply. And so they should be updated. Okay, and let's have a look at where the lasers are gonna come from. So they're going to come from the middle. So that should be fine. Just move this forward a bit. And let's have a look at this in the game. That's pretty good. So I'm just going to scale them up a little bit. Too much details. I maybe just get up and then apply that and see what that looks like. Okay, so what we're going to do is just save the same. And what I'll do is just adjust the lighting here. So let's just parent abbess lighting into a empty objects. Create empty. Rename this lighting. And apparently these two lights to this. Okay? And I'm going to just take this and rotate it. Make sure it's in the middle at the center. And let's rotate this. So I'm just looking at the character ship here. Just because the lighting is not as good as it can be. So let me just and just as some just rotating it just to balance the lighting on the front and the back. And just make something a bit more interesting. Dynamic go a bit more light. Coming from both sides. Maybe. It's easier to see a more rounded objects than it is to see on the, on the spaceship. These rounded objects are easy to light. These ones are more angular so they're a little bit harder to lie it just but let's have a look. So rotated those directional lights, you can see that brighter. A bit more of that blue light, but more moody in terms of the look of it. Now, okay, I'm just gonna say that in this lesson we turned our 2D enemy into a 3D enemy. 26. 26 make particle explosion: In this lesson, we're going to make an explosion effect using a particle system. Ok? So this is going to be, so let's create a particle system. So I'm gonna go to create effects particle system. And of course you can add this two objects if you want to add this to an existing object if you want to as well. But we're going to be using that script, so that instantiates this, basically creates one of these every time something explodes. So let's have a look at this. You can see that the controls are here. And this is the play control. So you can pause it for example. And then you can restart the effect, okay, which is what you commonly do. You can stop it. Of course, you've got the speed of the playback, how long you want to play it for, and then how many particles are actually in the scene. You see that they are very useful. And then how fast they are, which lays to simulate whether it's going to re, simulate it. So when we change all this stuff, whether it really simulates it, we will not on by default. And then it shows a bounding box as well. This is how far the object goes. Okay? So let's turn this bounding box off here. First of all, let's go to gizmos and turn off the selection outline here. So we don't get that orange outline and turn off selection wireframe which would get rid of. And I'm not sure you can see that, but there's a light blue outline which is the wireframe. So I'll just turn that off as well just so we can see this a bit clearer. If I deselect the particle system, you can see it disappears. Select and it will play. Okay, let's double-click this. And human. Let's move this down here so we can see all this stuff. Now this looks a little bit complicated when you first see it because there's lots of parameters and there's lots of things, lots of flexibility as very powerful. And of course it's all documented. You can press this spot here just to get to the help on the particle system. And it's also got tooltips. If you hover over this, it will give you a tool tip on there as well. And before a creative guys, I'm just going to just show you these two settings here, which is called looping and duration. So the duration is the duration of the effect. So we're just going to change this to something like 1 second, okay? And it seems to not have any effect because it's looping. So if you turn off looping, it's just going to play it once and then stop. Okay? So now you can see what the effect will actually be like. We don't want looping because we don't want it to keep playing. And every time something explodes and we just wanted to die after its exploited. Okay, so we'll just set those settings before we start. So the first thing we look at when we look at particles is creating the particles, so emitting the particles. So you want to come down to emission here. And you can see that it's emitting ten over a certain period of time per second. So if you restart this, you can see it's emitting ten particles and then it stops. So what we can do is actually tell it to burst and a bunch of particles over short period of time. And that's what's going to be the explosion. So we don't actually want this right here, so we're gonna change that to 0. Ok? And if you look at these little triangles, you've got different options in here. And these are the things that are common in most of these attributes where you can change this from a constant number two curve, and it will pick a number in between that curve or random between two constants. And we'll explain it a bit more as we go on. So let's just press the plus here. And now we've got this new event here is going to really study particles one time. And it's going to be over this period of interval. So if I restart this, you can see it just explodes all at the same time. And that's what we want. Okay? So the other thing we need to do is adjust the shape of this. So if we go down to emission, underneath emission, there's a shape. So by default is released in a cone shape. So you can see here, this is the cone shape. And so we don't want that. We want to change this to something else like a sphere. Okay? And you can see that's the spaceship now. And now it's going to be released in all directions and that it's more like an explosion. Okay? And the other thing you could use, don't up. So donuts, quite interesting because if you change it to die not you can see it's rotated in just ten of 2D here because he is rotated in this direction. I'll just rotate it. The controls for that array over here you've got position, rotation and scale. So let's rotate this in the minus direction. So it rotates and industry starts and you just get something more interesting because some of them go inwards and some of them got outwards. So I'm going to leave it on the top, not because it will give us a more interesting effect. And then I'm going to change radius to a small radius here. And I'm leaving a compared to my ship just so that I can get a sense of the scale of this. Because otherwise, what you can do is you can end up making something and then it looks too big when you apply, say, or cover the entire screen when you exploit something. So let's just keep this in, in our scene here so we can check how big is. By the way, this gizmo, you can drag these little dots here to change the radius as well if you want to do it that way as well. And that's just changing the numbers here. So the next thing you want to do is change the lifetime. So this is a very important parameter of a particles. So you can see that they carry on and they just keep carrying on. So we want to actually kill them off after a certain time. So the start lifetime is the parameter that you want to, you can see by default they're going to last for five seconds, which is way too long. So you can actually change this to something like 0.5. Okay? And then let's just reached up. And now you can see that they die. Okay, let's just change this to maybe a second. Disaggregate citizen a bit longer. But that looks very uniform. So the idea of particles is that is to randomize the effects. So we make something that looks more interesting. So everything we're gonna do from now on is just to randomize stuff and make it look more interesting. So the first thing we can randomize is the lifetime. So if we change that to between two constants, we can choose two numbers. And then it's going to choose a lifetime for each particle when it's born. It's going to have a different lifetime. So some of them will die early, some of them don't die later. So this one here, there's a little, if you hover over this area, you can see, you can slide it. So I'm just gonna change it down to the minimum. And I'm going to try and change this down to maybe point five-ish. Ok, so the shorts short lifespan and then they die. Okay? Remember this is an explosion, so it needs to be a pretty quick effect because we don't really want it to linger on because we're just going to be exploding loads of things. We're gonna be blowing up loads of stuff. Okay, so now you can see it sort of dies, but when it dies, it just kind of disappears, which doesn't look very good. So the thing we can do is we can actually change the color here. Color over lifetime. Now that we've got a lifetime, we can change a bunch of different things over the lifetime. So we can apply a force, we can change the color, you can change the size, all sorts of things, right? So let's change the color festival so we can take this on and open up the color over lifetime. And if we click on this, we'll get this gradient editor. So if we restart this, you can see nothing happens. We haven't changed anything yet, so nothing's going to happen. By default, we've got two options here. And what we can do is the bottom is a color, and this is the start of the particle when it's born, and this is when he dies. Ok, so let's change the color and when it dies to something a bit blurry. And I'm, I'm going to make it kind of electric bluey color for the, for the ship here because my lasers are kind of like color, color. So if you wanted to change it to something else, you can, you can customize this to wherever you want. It's very creative. Using this particle system you, you can change different aspects and make it look completely different. Okay, so you can move these things along and change where they occur. So I'm going to put this a little bit closer to this side. And I'm gonna make this white a little bit closer to this side, so it's a little bit longer when it, when it first is born. The top one here is for the alpha. The alpha is the fading. So this is how we're going to have it fade when it twice. So if we just bring this over here just before it dies, it's gonna start to disappear. So if you click on this last one, you can see the alpha value is 255, which means it's opaque. So if we just change it to 0 now you can see the checker underneath. That means it's see-through. So now if we restart this, you can see it's going to disappear. So it looks much nicer because it disappears rather than just popping off. So let's run randomized motion a little bit. We can do that in the shapes section. So if you've got to say shapes section, you can see that it's got this three sliders here which are really useful. So randomized direction one is the one that we use the most. So if we just look at this and just changes to one, you can see that it's basically going to look a bit more random. And then we can also randomize the position. So if you look at where these things start, I'll just turn up a little bit. They'll basically start in different directions there. Okay, so let's just change the size yet the size is way too big at the moment. So the Start Size is over here. So let's change this to a small number. And if we want to, we can actually pick a random size. So let's just, I'll just show you this first of all. So for changes 2.5. restart, you can see that they're smaller. And so now let's change this to a random value. So let's change this to between two constants, same as we did before. And we'll have a smaller number here. Let's just change this to small, something like this and see what that looks like. Ok, so we've got random values between certain sizes. Let's make it bigger or smaller than that assist. Come down a bit. Okay, something like that. And then what we can do is we can change this over the lifetime so we can actually make them smaller over their lifetime. So if we go to size over lifetime, timezone, it's basically, if you click on the section here, I can pull out, if you click on this, you can see the curve is basically going to change from 0 to one over lifetime. So let's just say it's going to become bigger over the lifetime. And you've got different presets here. So if you Chip press this one, it's going to get smaller over the lifetime, which is what we want. Okay? And you can actually adjust that as well. So you can actually change this to make some weight effects like this and have a look. T gets bigger and then smaller. Says change this more extreme. Okay, I'm going to leave it on that. It looks a bit more random. Ok, so now what we can do is adjust the texture so the renderer section, this is what the thing looks like. So we can actually choose billboard, which actually is just a plain that faces towards us. And that's why we can see squares when we selected it. When we turn off the gizmo, the, when we looked at the outline here, we restore that. You can see that the little squares that face towards the camera. Turn this off again. And so you've got different options here. You can actually choose a mesh, you can actually pick an object if you want. And you can choose different types of billboards. You can stretch it horizontally or vertically. But what we're going to do is change this material. So click inside here. We're gonna change this material to this particle star. And this is basically was included when we imported the space shooter pack. And it's just the texture is especially a particle shader and it's called a textual name, which is a star. So if I click on that, you'll see that it looks different the more solid. Okay? And we're just gonna put material when this trail material as well, because actually we'll do that later. Let's just have a look at this first. 27. 27 make particle explosion part 2: Okay, so let's add a bit more randomness to the motion by changing adding noise. So if we add noise, you'll see that we get some swirly behavior. If you add the tensile strength up here, you'll see this. I'm just going to turn on looping. Yeah, just temporarily, just today it keeps playing. And in here, you can change the frequency, say it changes direction more quickly. And I'm just gonna change the lifetime a little bit longer. So we can see this pay more. So you can see that they kind of changed direction and all that sort of stuff. So we can change the frequency, which is the size of that movement. So you can make a bigger movements like that or smaller movements like that. Okay? Maybe later on that it looks cool. Okay, and then we're going to turn on trails, okay, so these particles are going to leave trails. So if I turn on trails that they are, and by default, we need to add a material to the trail, okay? Because the trial is another particle system. So if you say assign trail material, you'll be able to do that. So let's assign a trail material renderer section, which we just looked at. We just click in here and just pick one of these. So I'll just pick the same one. And now you can see that we have the trails there. Okay, let's adjust them settings on this. You can see that basically it gets bigger, gets bigger and then smaller, and that's this width over trial. So if you make this smaller, it won't become so wide through its lifetime. And if you load this scaling thena, okay, and let me just lower this lifetime again. What I'm going to do is increase the start speed. Speed is over here, okay? And the start speed is how fast these things are exploding out. So you can make it bigger, you can make it smaller depending on what you want from the explosion. So let's just look at what one looks like, for example. So now you can see that they just appear and then the noise is the thing that moves them around. Okay? So it's a completely different effect. And if you can increase that to increase the amount that is going to push out the stall speed. Okay. So let's just change that to three so it's not going as far. Something like that maybe. And this is ten. The noise down a little bit is just a bit too frequent thing. And with the noise, you can actually affect the rotation and the size as well. So if you turn up the size, basically when it goes over the white area is you will get bigger. And when it goes over the black areas, they will get smaller. So I'm just going to turn down the frequency here. Okay? I'm just going to use that, but just say now that works. Just ten alpha now. Okay, let's try and apply this effect now. So what we're going to do is just rename this explosion. And then I'm going to put it into the prefab folder. There is. And then what we can do is select our bullet laser here and then drag it onto the destroy action that we added earlier, the explosion, and just add this explosion instead. So now, when this thing hits, something is going to create one of those particle systems instead. So that's DOD and press play. Okay, so now you can see it's working. So now what you can do is adjust things like the radius or the size. You could scale it down. And so the way I'm gonna do is just scale this down a little bit. So you can take this explosion and use the scale and just scale it down. It's going to set it down to about 0.6 ish. Okay? And then let's apply that. It becomes a little bit sharp when you scale it down. So I'm just doing that because I think it looks a bit cola. And then make sure you turn off looping very important. Otherwise, it's going to carry on playing, which is not good. So let's press play. Okay? And then you can also create more particles if you want to. So you can also create an emission section. You could make this bigger. So you can change it to 50 for example. And then see what that looks like. Okay? And you can notice I met the start. Size is big as I could, maybe changes to a little bit bigger. So different ways you can change this. You could apply the effect as well. Lets make sure you apply that to the prefab. And then you can just experiment. It's good not to make too many particles, otherwise, it will slow down the computer. Okay, and then you can get rid of this from the ISI and then save your scene. So hopefully that gave you a good indication of how to use particle systems and hopefully you can get stuck in, have a look and try them for yourselves and create your own effects. You could create a different effect, for example, for the green lasers. The other thing we do need to do actually, one thing I forgotten to do is actually get this explosion to destroy itself. So if you remember, with the explosion that we had before, this thing would do a time self-destruct after his play this animation. And we haven't done that for our, for our particle system. So we do need to do that. Otherwise, it's going to build up here. So every time we have an explosion, there's gonna be an explosion here in the hierarchy and it's gonna take up memory. So very important. So let's just add one of those to this thing. And so it will just take this explosion and component times self-destruction and just change that to 1 second. And then let's just test this out. If we can just make an explosion and then pause it, or I can manage them, it's too hard now. Pause it. And then you can see there's no more explosions apart from the ones that you have done. So if we just go frame by frame, and I can say it disappears after a few seconds explosion. This is quite handy By the way, if you're looking at animations and different things, you can pause it and then go frame by frame and play the game frame by frame. So you can see what's actually happening as we've already saved our prefab, so that's fine. So in this lesson we create an explosion with the particle system. 28. 28 add a particle asteroid field: In this lesson, we're going to look at another example of particle system by creating a asteroid field. Okay, so in the background what we're gonna do is create a particle system, which for instance, one of these asteroids. And so it will have a bunch of these in the background and will make them a little bit darker so that we know that we can't smash into those and they're in the background. Okay? So we're going to have a look at a couple of features which is for lighting as well, which will help you in terms of controlling your lighting as well. So let's create a fact particle system. And I'll just rename that then the asteroid field. Okay? And so the first thing we're gonna do is get this in the right position. So remember this is a cone. Initially, the emission is a code. So we're just gonna go to a mission and we're gonna change this to a shape, excuse me. And we'll go to the box. Box. So now it's a box if you look here and then we'll just drag these out. Okay, and I'm just gonna drag them out to the size of the background, roughly. Maybe even a little bit bigger. And then I'll just make it taller as well. And this is just adjusting the numbers here. You could just type it in here if you wanted to, or slightly along like this, using your left mouse button. In this area here you can see the two little arrows and dismay that bigger. Okay, let's make it thicker as well. So remember this is a 3D particle system. So let's just have a look at this. You can see the thickness there. So let's make this a little bit thicker and we'll get more parallax that way. So let's make it thick. And if you remember, this background is here, and our ship is in the middle of this line here, is in the middle there. So let's push the background back a bit more just so we got a big space and we're gonna get more of a parallax effect. So let's push it back. And we might need to scale it a bit later, but let's just push it back a little bit more. And let's just go to 2D mode and scaling up as well. Go to a center to say it looks roughly the same. So it goes scale of two. And I'm over here. Okay, and then the asteroid field is now got some space to actually have some thickness to it. So let's push this back. So we want to see this line here. We wanted to be behind that. So, so none of the asteroids are in front of us, in front on top of the ship here. Let's push it back here and just make it slightly less thick. Okay, there we go. So now that we've got our asteroid field and we might just need to make it bigger now because of the just made the background bigger. So student. So now let's look at the mission. The mission at the moment is emitting at a rate of ten per second. So we just want to turn that off. And we just want to create a bunch of particles at the start. And then that's it basically. So we're just going to create an event here, list at best. Click on the plus. So now it's going to create 30 in a small space of time at the start of the frame. And you can see that it basically creates itself for press restart and go. Okay, so what we can do is let's turn off the speed that it doesn't move anywhere. So let's say starts speed 0. Okay, so now that they're just dots, and let's have a look at the amount. Maybe just changes to a 100. If you more of this. And we can adjust this later if we need to. And then let's look at the lifetime so we don't want them to die. So let's say, remember this is in seconds, I think. So this is five seconds. Can lost five seconds and it's going to die so we don't want them to disappear. That's gonna look weird. So this will put in a big number here, depending on how long you think a level is going to last, you can put in that number. So I'll just put in a big number here, like ten hundred ten hundred seconds. And then we should be fine, okay? And then the duration of this should also be 1000 as well. So it doesn't restart until it's finished, until they died. Okay, so they're just going to stay that, right? So now we can have a look at the way these things look. So let's come down to the renderer. And we'll go to the render mode, and we're gonna change this to mesh. So now we can actually pick a meshing here. So because section where we can actually pick and you can see it's picked cube by default. So you can come in here and pick one of these asteroids. I'm gonna pick Asteroid three because it's a bit more interesting. Okay, so there's a street tree and it's got a shader, which is the default particle shader applied to it. So we don't want that shade up. We want the particle three shader. So we can just click in here and pick particle three. Asteroid three, excuse me, no particle three. All right, there we go. So now we can see how asteroids that, so you can say here that they all orientated in the same direction. So you can see that they're kind of facing the same direction, which doesn't look very natural. And there they are the same size actually. So we can adjust the size and we can randomize the rotation as well. So let's just say start rotation here. We're going to go between two constants, two constants here. And you can just change that to 360. And so you can see that they rotated between two constants. If you look over here, you see them change it back to constantly. Say that they were facing in the same direction. And two constants, you can say that I rotated. Now, if you want it, that's just going to rotate it in one direction. So it's basically just the, this y direction, does that direction here. So it's just rotating around this direction here. But what we can do is we can twist it and turn it and have it rotate in almost all directions. So instead of doing a 2D stop position, we can do a 3D stop position so we can separate x, y, and z. Ok, so now you can see we've already got zed value. We can just put in 360 on all of these. So it's going to pick a value between. Three hundred and sixty and zero for the x, y, and zed. Stop position. Ok, so that's gonna be a bit more random. And then we can do the same thing for the Start Size. And I'm not going to separate out the start size in terms of the x, y, and z because I don't want to ruin the shape of this asteroid because this has been modeled in a certain way. Something that you can get away with that like trees and certain models. But in this case I'm just gonna do start size and I'm going to choose between two constants. And then I'm going to choose something small and something big. And then we'll see how it looks. Okay? And I want them to look far away. So I'll make most of these smaller than the ones that we see in our view. Okay, so let's have a play. I'm going to meet the audio here. Let's have a play and see what that looks like. So now you can see we've got a lot more depth in our scene. And we call these particles in the scene. And if you want more of those or less of those, we can just turn up the number. Okay? So it's a little bit difficult to see that this is in the background because they're the same lighting as the ones in the foreground. So how do we actually control what gets lit and doesn't get lit? So if we just stop this, we can actually tell unity to not like certain objects by using layers. So that's really useful. So if we go to lighting and just click on one of these light, lights, we can actually pick here which layers. You can see here. It says culling, mask, everything. So this is what is getting lit. So if we just pick whatever we want is for, let's just say we picked nothing and then we picked player. Then it will only light up the player, or I don't think it's on that layer. So let's say enemy for example. And you can see basically you can pick whatever you want to be lit. So what we're going to do is we're just going to add these props to a lab and then less light that layer. So let's just make sure that these guys are on layer. So if we go to the prefab CIA have looked at the asteroid and it's on the Enemy layer. So let's, let's add the asteroid field to its own layer and then we can undertake that so it doesn't get lit. Okay, so let's grab this guy and create a new layer and layer. And let's just call this background. Okay? And then we can just select this guy. Remember making it doesn't actually add it. So once we've created it, we can add it to the lab. And I was in the lab. And now we can select these guys together. Remember, we've got to light, so select them both together. And then we'll go to everything and turn off background. Ok, so now these things won't get. Let us have a look. The particle shouldn't get it. So you can see that the dark now. So now what we can do is we can create our own lights for those objects. Okay, so let's create some lights. Create, I'm just going to create one light because I want it to be quite dark, so directional light. Okay? And then we're just going to de-select, say nothing. And then we're just going to click on Background. Okay, so now it's only selecting the background. So now you can see that it's lit. And so what we're going to do is just rotate this a little bit. This sort of backlit silhouette so you can pick which direction this is, say the side here, okay, and then you can change the color. Let's change this to okay, so now they're in the background and they're not getting in the way, but they just adding a bit of visual detail and you can have whatever you want. You can add and subtract chips or props that you've made, anything you want to. But using this method of using particles to do this is very light and in terms of processing. So it's really good way of distributing objects in your scene. And you can do things like trees or rocks or whatever you want to say. Let's have a look at creating another light. Yeah, let's just call this background light. I'm just gonna put this in here and the lighting group here. And just gonna duplicate that. And let's select the asteroid field so you can see. And let's rotate. The lens is going to make this front on a little bit, just to light this up a little bit. And then I'm just going to turn it down quite a bit. Says just take this and you don't have to do is you can leave them a silhouettes if you wanted to. But I'm just gonna make this a little bit just a tiny bit lighting on that just to define the shape of it. Ok, that's been up. So those are the background rocks. You can't gain that you can't crash into. Okay, so I'm gonna say this. In this lesson. We created an asteroid field using a political system. 29. 29 make final adjustments to level 1: In this lesson, we're going to make some final adjustments to our level that we're going to start off by changing the background size. So you can see it's a little bit repeated that. So I'm just going to grab the background and change the scale to about my wish is just take the skeletal Hill and scale it up. Just so we didn't see the repetitions anymore. So now you can see it better. Okay? And then we press play again, actually see the player is actually on the bottom of the screen a bit too to fall down. So just need to adjust the look at for the plants are going to look at. And if you remember, we had this little null which the camera is looking at, we just need to move that down a little bit. So let's just change this from 3 t3 to something like three and give it a try. And maybe a little bit more. That's below 3.62.6. Okay. That's way better, right? And the other thing is he press play, watch the asteroids. They cannot change halfway through the operatory, but just a few frames in. And that's basically because of the rod. So if we go to the asteroid field, you've got this attribute called pre warm, and we don't want that, so we turn that off. Then it's not gonna stop before the game stops. So turn that off and then press play. And then it should change. Like it's either lighting is not changing. Okay. And while we're adjusting lighting, let's adjust the lighting on the background a little bit. So for the, for the asteroids because it's a bit dark at the moment. So just going to have a look at those. Press pause. And then now you can see the asteroids. And then we can go into lighting and background and just increase the intensity a little bit. This do bring them up a little bit. So as to foreground background. Okay, so just remember this value is 1.60.3, full. Stop playing the game and just change that back to what it was, 3.41.6. And as I play, so now you can see it's a bit bright up there also the asteroids here, a little bit shiny. So I'm just going to adjust the materials. So I'm gonna get to materials. And you can see these three before asteroid shaders are the ones that we want. I think one of them is for the background. And I don't want to change that. I think these three, these three are the ones we need say, well bet CDL change here anyway. So let's grab the first one and we're just gonna change the smoothness. So you can see here, this guy here, you just change that to make it slightly less shiny. This is blurring the reflection that the shininess. So just do the same thing. This guy just says No as Smith. Okay, let's print out that better. Okay, and then in order to apply this to the next level, we can make it easy for ourselves by creating a prefab that say, if we take the lighting and just drag that into the Prefabs folder and spinal Prefabs folder. So let's grab this lightings group and we'll just take this and drag it in here. So now that's going to be pre-fab. Say, if we want to reuse that, we can just drag that in and it's gonna be a lot easier. Okay? So you can also like any final adjustments you want to the colliders. If you want, if you want to make this a bit wider, you remember these colliders, these two here. I will control how wide this is going to be. This game is going to be, so you can adjust those as well, just make any final adjustments. And then I'm just going to save the scene. In this session, we made some final changes to our level one. 30. 30 make final adjustments to level 2: In this lesson, we'll met the final adjustments to level two. So we applied quite a lot of changes to this level. So we're going to do the same for level two. So let's grab this asteroid field and make a prefab out that so we can use that in our other levels. I just get to prefabs and just drag that in. So we can easily reuse that. And then got to player. And let's apply the changes that we've made to play as I'm actually select the top level and click on apply. And that just means that anything that you've changed like a scale, for example, will be recorded in the prefab. So when we open up the next scene, it should be bigger because if you remember, we scale this up. So let's go ahead and I've not seen, so it will just good scenes here. And I've know, especially to save the scene. Okay, and so now you can see we've got our, I'll say let's press play just to see this. Ok, so you can see that the scattering changes being implemented, which is good. We have to update our players here, the Emmys. And we need some asteroids in here, and we need the lighting. Okay. So let's go ahead and get to o prefab. So maybe no prefabs. Let's go to prefabs here and we'll go to lighting. And so is this one here. And I will just drag that in now. Okay, so now we've got our lighting for this guy and we need to adjust the colors so you can see that the blue kind of rim light, and obviously we change the color of this to red. So we can just come in here and just have a look at the fill light and take this and grab the color picker and pick something that you like. Something a little bit less saturated, maybe something like that. And let's just play with this. In fact, I'm just gonna make this a little bit whiter because, because it's red already, it doesn't really need anything too crazy. So just down a little bit, and that should be fine. And then we will have a look at the asteroids. So that's dragon, the asteroid. And you can see that that's got a blue on it as well. So there's a blade that and so we just need to change those two lights. Remember, we've got two different lights for those. So we can just change these to a desaturated colors. So it just changes the white tail and then change them as well. And as I've look, okay. And we can adjust the position of these actually see where they are. Thing is, is bigger than the other scene set. Smaller than yellow zone so you can scale it down if you want to. Or just some of the parameters on the, on the asteroid, whichever you prefer. Okay? So there's asteroids. The astroids don't seem to be showing in the, in the game here. And that's because they probably are behind the background. So if you remember, we pushed the background back a little bit. If we look at the asteroids, you can see that they're behind that said, we just take the background and just move it back a little bit. And I'm going to scale this up as well. So the scale this, so it's not so repeated. And U2 are E15. And press Play. Now we go, now we got our asteroids. Alright, so that's the asteroids. And now we need to just change the enemy follow. So if we just go ahead and save this, now, as you say, this thing is we've done quite a few changes. And that's gotta be bad guy follow. And what we're gonna do is we're going to just copy this guy. So I'm going to duplicate this. And it's going to rename that to follow. Well, well I 3-D. OK. And then we can change the script here so we can tell up one day. And then measure on your 3d one here. And we can add for the player. Okay, and then let's just have a look at the settings we had. So I'm just going to the old one here and despair to the settings that we have to fly up there with a speed of 0.1. So we can just put that in. Here. It's the same sort of behavior, ok. And then we've got two enemies here. And you can say these are our enemies that we've got. So let's just change the color of this as well. So if we drag into seeing festival, just zoom in, there's F to frame it. Maybe we can change the color of this to a different paint job. So we can go to the UAV Trident and coincide here to the actual object. And you can see this is the shader Matt toy. And we can change the albedo here, or we can tint it. We can play the color here. Let's just change this because it's got another paint job here. Say, let's bring that back here. And we can use the military ones. So this is the one we're using at moment. So he changed that to the military runs every grab this and just drag in here, needs a change. And then split view these indices. So I'm just going to combine here and apply the changes. And then I'll just put in a few days. So I'll just put these where we had done before. If gate and OK. And so they're in roughly the same position. So I'm just gonna get rid of these old ones. As in the enemies folder. Let's get rid of those. Delete. And then just dragging these guys. This or this mass normalized. And then press play. Big zealous changes to be smaller. So make sure that it's taken the change and go to the Prefabs. Change in here again, in just 2.5 maybe. And again that's a bit better. Okay, so now we've changed. There we go. And now we've changed the lighting and the baddies, the player and the background. So we should have the asteroids as well. So that's not look. Let's say at the scene. In this lesson. In this lesson we changed. In this lesson, we changed. In this lesson, we made our final changes to level two. 31. 31 compile final build: And it's doesn't move, build the game. So let's go ahead and make sure that we've saved the scene and we can get to File Build Settings. And it should all be set up. So make sure you go. You're seeing here, this is 00 is a menu scene that you've got the first level and second level, and make sure you've got it on PC. And I've got my target for platforms at two map because I'm on a Mac. And then you can just say build and run and pick where you want that to go. So my Builds folder that we had earlier, and you can version too if you want to compare. I'll just do that and then say Save. I'm going to go through and build all those assets. And then it's going to play some look at this plan won't be able to screen here because it's recording the entire screen and it's gone full-screen. Background asteroids, Luke huge and the women. So you could have just as if you want to level two. So in this lesson we may define a build for, okay.