Learn How To Make Games: Videogame Development in Unity | Daniel Robledo | Skillshare

Learn How To Make Games: Videogame Development in Unity

Daniel Robledo, Computer Science & Engineering Student

Learn How To Make Games: Videogame Development in Unity

Daniel Robledo, Computer Science & Engineering Student

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
20 Lessons (3h 35m)
    • 1. Introduction

      1:45
    • 2. Software, Resources & Class Project

      4:12
    • 3. Pre Knowledge Needed

      1:49
    • 4. Setting Up Our Unity Project

      6:52
    • 5. Moving Our Player & Enemy

      12:55
    • 6. Implementing Our Shooting Mechanic

      16:46
    • 7. UI Creation & Stats Tracking

      15:24
    • 8. Shield Power Up Development

      8:13
    • 9. Managing Spawns

      20:18
    • 10. Creating our Main Menu & Game Over Screens

      13:12
    • 11. Adding Two New Enemies

      19:12
    • 12. SpeedBoost & ShootBoost Development

      11:31
    • 13. Polish First Stage

      3:04
    • 14. Animating Our Game

      17:13
    • 15. Adding Particles To Our Game

      10:17
    • 16. Music & SFX Implementation

      16:26
    • 17. Entrance & Game Over Animation Development

      26:09
    • 18. Polish Second Stage

      1:59
    • 19. Building Our Final Game

      6:45
    • 20. Course Wrap Up

      1:05
  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels
  • Beg/Int level
  • Int/Adv level

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.

130

Students

1

Projects

About This Class

Learn How to Make Videogames with the Unity Game Engine

If you've ever wondered how videogames are made and if you want to learn how to do so, this course is for you!

I have spent more than two years learning about Unity both by working on little projects and by enrolling myself in pure self-learning. I'll teach you all of the fundamentals about Unity and a lot of mental processes to follow when you want to develop your own game, no matter the software you are using.

In this course you will learn:

  • How to start thinking like a real game developer: design features, plan the code, manage optimization...
  • How to work with Unity and all of its basic features
  • Basic to medium level C# coding skills and best practices about programming
  • The fundamentals of animating and creating both visual and audio effects
  • Mental flow thinking processes to follow when developing new features to your games

You'll be creating your own arcade-shooter 2D videogame using the techniques from this course.

Even if this is your first time with game development, you'll find all of the new learning simple, effective, and easy to apply to your own projects!

Meet Your Teacher

Teacher Profile Image

Daniel Robledo

Computer Science & Engineering Student

Teacher

Hello! My name is Daniel Robledo, I am 20 years old and I am a third-course Computer Engineer student.

I love videogame development, art, programming, self-development, and productivity.

If you want to know more about me you can find me as "Daniel Robledo" on pretty much any social media, and in case you want to know more about me, check out my web page at danielcrobledo.com

I'm looking forward to helping you learn a lot and hope you have the same fun taking my classes as much as I do on making them!

See you around!

See full profile

Class Ratings

Expectations Met?
  • Exceeded!
    0%
  • Yes
    0%
  • Somewhat
    0%
  • Not really
    0%
Reviews Archive

In October 2018, we updated our review system to improve the way we collect feedback. Below are the reviews written before that update.

Your creative journey starts here.

  • Unlimited access to every class
  • Supportive online creative community
  • Learn offline with Skillshare’s app

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.

phone

Transcripts

1. Introduction: I think what they loved the most about video games is the ability they have to produce feelings into people and to transport them to places they haven't even built on. Hello everyone, I'm Danielle or leather and I, My Computer Science and Engineering student than an indie game developer quiz. So passionate about both videogames and programming. This course is all about loneliness kills him making video games with the Unity game engine, which will help to get started with your game development lending bath. Making games is not easy. Some process that combine is hard work and love of thousands on people. Making gorgeous in fully functional system or deciding interchain mechanics are just the tip of the iceberg when it comes to amazing process of making. Again, this course is going to be a full world through, through the whole process of creating arcades, shooter video games in Unity. In which I'll be focusing on teaching you the mental processes that you should be applying when creating a video game. We'll start with the development of the design pillars of the game, continued with the formation of the name loop. Then move to the addition of animations and both visual and audio effects, convenient with their process or policy and building of the final product. All of these combined with full on animating as Dionysius about a very fundamental aspect of developing games with unity and a class period in which you will see how much you are pervasive. If you're one of those people who wants to learn how to make it like these early, there'll be lover will melt on the information out there. And thus in no way address that. I think you will love this course. I am really happy that we decided to bring the scars. And I am so excited to do a leading you through the social path. Let's get the standard. 2. Software, Resources & Class Project: Hello everyone and welcome to the first of the two preparation lessons that we are going to go through before we start making our game. In this lesson, I will tell you more about the class project that we are going to work with. We are going to take a look at the resources you need to get. And I will also tell you which programs you need to download the Northern to follow along with this course. Let's actually start with the software. Remember that you'll have all of the links for the software mentioned it on the description down below. For this period, alternate is the unity gay men Jain, and some kind of text editor. My personal favorite is Visual Studio Code, but you can also use other ideas such as Visual Studio or sublime text. To get the Unity editor just need two things. And they need the installation for the version you want to use. In my case, it will be that Joseph epsilon 20.1 version and an active license for the usage of the program. Don't worry, because humanity is completely free for non-commercial use it you just need to create a Unity account and then link it with your unit installation. You can just download the Unity version you want to use. But I highly recommend getting the unity half Program because he could make your life so much easier by combining all of your Unity projects and versions in one place where you can create change and delayed projects and installations for the text editor, even though you can use pretty much separate code editor out there, I really recommend you to use visual studio code because it has a great integration with the Unity game engine. To set these two guys up, GS need to be sort of Studio code. And then inside unity, go to a preference Sentinel tools and select Visual Studio code as your code editor tool. After you have done this, I suggest you to install the following extension through the Visual Studio code is stored. Don't worry, because all of them are completely free. Cecil extension. This extension gives your program tools for highlighting and debugging C-Sharp code. You need to contact snippets. This exclusion issues to code more efficiently by giving you auto-complete features for your unity code. Unity tools. This extension enable feature for your program out of the appropriate code. For example, allowing you to search Unity documentation just from the Visual Studio code or by created comment organizational folders for your new project and debugger for unity and GitHub pull requests and issues. These two essentials are only for those of you who are comfortable with both the debugging process and self-control. And they both works perfectly and are so easy to use. Alright, now you have everything you need to work on your game. Again, feel free to use other code editors or meristem as tools to fully customize your game development experience. Next, useful to check out the resources page within the glass to see all of the files that I have led you in order to and then to your period to start with, I coupled light it both non-empty knew in Unity project and the final Unity project so that you have a constant reference of how your work should look like. Next, I have also uploaded the complete set of assets that will be using for this project, sprites, sound effects, and music. And finally, there is also a SIP containing all of the finished scripts so that you have an easier time taking any conduct that you have. This scripture are exactly the same as the one we will be coding later on, but they are fully commented so that everything is clear to you. That is also a link on the description for the GitHub repository that I used to work in this game. There you can take out every change that I made to it again with the corresponding milestone and lesson associated. The last thing I want you to do right now is to create your class project. In this project, you will post your progress as you go through the lessons and your final gang once you build it so that I can take a look at it and give you vote feedbacks and my congratulations. To do that, you can just click on Create, Glass project and following the skillsets instructions. Don't worry about carry it in your own Unity project right now. We would create it later on. Great, so now you have everything you need to start with. Let me know about game development and in unity. And I look forward to leading you through this awesome path. Thank you so much for watching, and I will see you in the next lesson. 3. Pre Knowledge Needed: Hello everyone and welcome to the second and final preparation lesson before we start making our game. In this lesson, I'll tell you the knowledge that I'm expecting you to have before jumping into the game. Don't worry, because the only knowledge you need to have right now is about the basics of programming. Do you need to know the fundamentals of our variables, conditional statements, loops, and methods. I will not be as plainness whether float or a Boolean is neither will AS playing had to pass argument to a method. For example, concepts, you should be already familiar and width. And even if you're not, don't worry because it's so easy and you can learn about them as you go through the course. Would indeed angular be explaining is everything related to Unity. All of the components that we are going to use in this game will have their own separate exploration within their lessons. I will also be explaining more advanced programming aspects like objects, sterilization, and refactoring. And finally, for all of the methods including within the Unity components, such that the get component method or the GameObject that find method. I will explain in both their complex ones and those which doesn't have an intuitive name. Even though we are going to programming CSR, It is totally fine if you have only spitting in some other languages, as long as they are similar to CSRF. For example, if you had perimeter B from Java, Python, or C, you're hard, no progress in understanding this course grade. So that will be all for this lesson. I hope you're excited to start it because on the next lesson, we are finally getting right into making our game. Thank you so much for watching, and I will see you there. 4. Setting Up Our Unity Project: Hello everyone and welcome to the first lesson of the course. In this lesson, we're going to set up our Unity project and game objects. So the first thing that you need to do is go to unity hub and click this little arrow and say that you're in diversion is make a saying I'm going to use 2020 version and just say ledger name which is going to be specialised for me, you can change it, you won't answer electricity and click Create. Alright, so now that your prejudice created, let's do a really quick tour through all of the window does appear here. And this is your hierarchy window to control your game objects. This is your period window to navigate through your folders. This is your inspector in which you are going to control your current gameObject properties. And this is where the magic happens. This is the game view in which you are going to see how you are again, is going to look in the future and Judas sin, and which you are going to control and your gaming structure. There are a more windows that appear here like Console animation, audio mixer, but don't worry too much about them. We will be using them later on. Alright, so the first thing you need to do is go to your scene. Sandy led the sampler scene, and let's create a new one, which is going to be called level, which is going to be our main sin. Let's create on level, don't say because we have already delayed it and go to your main camera. Gameobjects haven't changed the aboveground tomb, whichever you want it make asynchronous, you go with black, then gone to gain Bu, unset your resolution. I have created accustomed, custom one which is 1080 b, which is this big or retribution for our nato, the monitor. But again, feel free to just stood wherever your solution you want. Great. So the very first thing you should do whenever you establish our project, east created both folders and GameObjects. And it started with game objects. To create a game object, you just need to right-click and create empty. And there you have your beautiful new game of debt. You just rename it at some components, whatever do come. Before we start creating our destructor, let's learn what a game object is. Gamma of this are the fundamental objects in unity and that represent characters, perhaps an affinity. They did not accomplish mass in itself, but the others are containers for other components which implement the real functionality. You can think about a game object as a box in which you include different components, satellites, Periander, glycerin or Artesia script. We can also use gameObject suddenly structural tool creating game objects within game objects. In this case, I'm going to follow a five brand three instructor. These branches, I'm going to be an entity subject to start a player, enemies and power-ups. Below, just for the background on boarded, a projectile objects for both players and enemies. A controller object for the camera starts a new eye and a startup that we'll be using later on. You can create whatever structure you want or just going with no startup at all. But I highly recommend following this trip Brooklyn, since the simplest to understand. Alright, so now that you have and your gameObject 3D structure had to Visual Studio Code, I'm press control C, P or commands if p, you are on Mac and type folder. And one of the extinction that we have already installed this unity tools, which has a feature and that generates all of the data we need. So just quit generally folder and there you have all your folders. And now let's quickly go to unity and change materials to sprites. You're gonna live in TEN materials, but I like the sprites name more. Alright, so the next thing we're going to do is import our sprites and audio show. Just go to your folder and it's as simple as clicking and dragging. All right, so now that the process is done, you should see all of your beautiful as price and these are not mine. These are from Kenny's, kenny suffering online resource for organ development assets. And you can just go to do the type space, and this is the one that we are going to be using. I have added some sprites, but we will be using them later on. And the sound effects are this one. And in music, if it's firm Patriot, which is free online, realty music, which is pretty good. Okay, so the last thing we're going to do in this lesson is set our background pleasure and enemies. So just go, Let us start with the background and add a component which is going to be a sprite renderer. Since it's the first time that we use as per rendered this quickly and learning what it is. Spread render is a component that allows to keep us happy solar presentation to an object within a game. The main property of this component is a Sprite, depending on which he meets you sit in this property, Europe did we'd look one way or another. There aren't other attributes that come helpful for visual effects, such as color or flipping. But we are going to take care of those when we start using animators. Remember that if this component is disabled, you won't see your gameObject. Keep done in mind if you end up no nowhere where your gameObject is. All right now, all that is left to do is add our sprite. And I'm going to go with this one. Don't worry too much if your background looks really dealt with, not pretty right now because when we animate it is going to look pretty, pretty awesome. And now with your escape to set it to be just a little bit out bounds of the game because we will need that when we animate our camera. And now let's do the same with our player and enemy, right? So we have both our player and enemy. And I went our enemy to be a little bit bigger. So just go to a scale and increase both X and Y. There you go. Great. So the only thing left to do is create our brief apps, which is just as simple as clicking a GameObject and dragging it to your pre-fab folder. Don't worry too much if you don't know what prefabs are, we are going to be explained and then later on. So this will be all for the first proper lesson of the course. Thank you so much for watching and I will see you in the next one. 5. Moving Our Player & Enemy: Hello everyone and welcome to another lesson of the course. In this lesson, we are going to get our played and enemy moving. So let us start with our player movement. And the very first thing we need to do is add two new components, which are going to be Polygon, Collider, 2D and 3D body. Most colliders and read bodies are both components commonly used to manage collisions are vast. Collider gives your object an area represented either by a box or a polygon, which acts as Award for other objects who also have these components, these collisions can be their actual collisions are triggers. Collisions affect directly the objects present in pretty much the same effect that our real life Cartesian will have. Sugars instead only affect the code of the game. This is especially useful if you want GD up just not to lose momentum. Are IID body physics to an object. This physical properties can be used to simulate real life physical phenomenon such as gravity, movement or collisions. These two properties are going to help us both move our entities and register all of the interactions between them. Alright, so with your polygon Collider 2D, you don't have to do anything apart from selecting the polygon collider and not the box collider use like the box collider is not going to adapt to your gameObject Sprite if that is what you want, go for it. And for your read Body 2D, you just need to make sure that your gravity scale is set to 0. Because otherwise, Now I am going to click play with gravity, a scale of one and you are going to see that my player is dropping down like that. So just make sure to leave it on shadow and everything should be alright. Yeah. Now before we jump into the code, let's do the same for our enemy. So again, polygon Collider 2D and just make sure to get your gravity is k2 0. And the last thing that we need to do is go to our borders object and create some borders. Let's just do left. And now at the Box Collider 2D, because we want it to be above, so just move it around. So let's place in around the left middle size and just increase your y scale value. So it covers all of the screen, is way whenever applied or an enemy heat, these green box is going to get no table to go off camera. Alright, so now that you have origin borders, let's go to create our first descript and just click right click, create new C-sharp script. Unless colleague and I hear a script is essentially a program that affects the object that is attached to. You're going to use this case for pretty much everything from a sterling stats and information to register an input, or even to make a script animations. You can write anything sharp code you want in unit scripts. But whenever you create a new script, you'll find two Core Methods, Start Method and update method. The start method is called once when the gamma star just in the first frame, that the method is called once per frame when the game is running. This mean that if your game runs to 30 frames per seconds or FBS, the method will be called 30 times every second. If your game runs at 60 FPS, it will be called 60 times per second. Another important fact about the script is the difference between public and private instances. Whenever you make a method are bearable public and we're making them accessible through the inspector and other scripts. Making things private may seem useless at first, but it is important to have as much of your code private as possible for security reasons, since we're just starting with game development fruitfully to just leave everything on public. But remember that our good practice in programming is to have as much as possible on private. Remember that you need to add your script component to this corresponding object. And keep in mind that you need to call your code from there, the method that you want to act it automatically. This is something I forget, the Roman robot again, they'll say. Alright, so now inside your player escape. Let's first of all create some variables which are going to be oblique, float, x, feed, and family flowed. Why? It's great. All right, so now let's create another variable, this time private, which is going to be tight, rigid body to the, and I am going to call it RB. And now let's link in this script variable two is our actual read bodies of these and get component, Rigid Body 2D. And there we go. Now I'm going to do RB, freeze rotation I think is to true so that our game up, it doesn't rotate when it receive is ahead. All right, so just create two new methods. One for taking aware real player input, whether it's pressing a key or another one. And call that metaphor and your update method and method to actually move your player. All right, so let's start with our check input and great input. Not take input but input that get C0, C0 cold. And now that WWW, for example. And this method is going to return true if the real pleasure is pressing the W key. So we went to him with our pledge here on the y axis and forward. So in this, in this method, the first argument will be sends a, whether it is external y-axis and forward is one if it is forward and it's minus one if it is not. For now, all we need to do is first of all, check if our detection is Y or X. So if direct children that equal, I mean that to uppercase dot equals. Uppercase Y. Then we move our player upwards. And to move our player upwards, or we need to do is say RB, that at force, which that force to the game of debt based on a vector to a variable. And we are going to create it inside the arguments are new vector two. And on the x axis, which is a first argument, we want to not move at all and on the y-axis. And the second argument we're going to move as fast as our Y SP dictates. And we went to multiply it by forward because we want it to go up. Ether world is one. And then worse if it is not one. Oh yeah, he has noticed that I grabbed read it. Read it. Sorry, not read it. Alright, so now let's go back to Unity and go to our entity player and setae where speed, and I don't know it's 323. You can mess up with these values as much as you want. And there we go. Our player is perfectly moving. And as you can see, it colliders with our border. So it can go up a screen. Perfect, alright, so I have already done every direction unless tested out on unity. And as you can see, we can move freely our player over the whole screen and we can not go off the screen. Perfect. Alright, so before we move on to our enemy moment, I forgot to tell you that you need to actually add your script or your player gameObject. So just add component and type player. So let's create another C-sharp script which is going to be NME. And actually let's already added to our enemy game object. So let's go to enemies, shoot there, and let's go to Add Component. And you can just type your name on. It will appear Great. And before you jump into code in anything, you should pause a second and fully think your goal. Right now, we want our first MME to move, and we want it to move from one generation to another on the x axis, this moment should not end until the enemies Destroy. The way we are going to move our enemy is through applying Andreessen dolphins to its rigid body. And we are going to control the direction using two limits. By tracking our enemy procedure, we can decide whether they should be applying it to the right or to the left. Alright, so to control our enemy boom event. And we need three variables which are going to be public float, excess speed because where should they only move on one axis? Vector of type float, which represent the x limits. Limits, and private Boolean, which is going to tell us whether or not it's going right. And its neighbor tone through, for example, I don't know. It has a mother. And of course we need our RB. So copy what you have already done in your players grieved and copy-and-paste. Great, right, so let's get right into our movement code. So the first thing you need to always do is create your method and place it on the update method. And now let's first of all decide if we are going right or no. So if we are going right, we are going to do something. If not, we're going to do something else. Now let's control these Boolean variables. So we need to know if we have surpassed our x limit. So if these GameObject that transformed we represent the property that contains a scaled rotation and positon that local position x bigger than our second x limit. This means that we need to start going left. So, sorry, is going right equals two, no, is going right. So we can invert it value. And now pretty much the same with the other limit. So this form, sorry. This transform, that lava or city-owned, that x, not y but x. Smaller than our fest x limit. We changed our variables. So is going right equals to know, is it going great? And now all that is left to do is if we are not surpassing the limit, we want to move on the corresponding direction. So RB that force. And we are going right. So new vector two. And we want to move a spit on the x-axis and 0 on the y-axis. And now the same for the other direction but with minus excess speed. So we move to the left. Alright, so I have already set to limits and to set your own limits, just warfarin, your enemy and tech, your exposition. I want this enemy to go right until his her pass. This limit, which is 0, and go left until it's our past minus2. Now, if you click play, just mess up with this value as, as much as one when you are fine with your enemy, move on. Let's fight for me. Don't worry too much if it collides with the world's because later on in the game, we are going to polish our game and make this movement a lot of better grades. So that will be all for this lesson. We have our player moving and our enemy move in. And on the next lesson we are going to get these two guys shooting each other. So thank you so much for watching and I will see you there. 6. Implementing Our Shooting Mechanic: Hello everyone and welcome to another lesson of the course. In this lesson, we are going to get our shouldn't mechanic. So we need to both implement player prioritize and enemy per neckties. And let's start with our player predict things. And the first thing we're gonna do is create our projectile prefab. So let's go to prayer, pray appetites, and create an empty updates. Let's rename it to fly projectile, for example, it doesn't matter too much and let's first of all, at our sprite. So a sprite render. There we go on to an sprite, Bian De Lei sars. And I'm going to go with Lee's, lays her blue three. Great. So we have high where projectile and let's move it around Justin for the player. Let's see. Yeah, that's I would size. And now let's add some components. We are going to add a polygon Collider 2D. Just make sure to, well-known here is to telephony it our read body. So let's go to Rigid Body 2D and click simulate it and body type kinematic. Great. So let's get right into the code. Now let's create another fish or a script which is going to be called Project pyrrhic tail. Great. So inside our period had a script. First of all, we need to vary bolts, which are going to be a float project, tidal speed, and a public boolean, which is going to tell us if he does have Player projectile or not. Rejected because we want tau, where player projectiles to move our cars and our enemies pray a testimony downwards. So as always, first create a method for your functionality and then call it on the update method. And the way we're going to move our predict tells is through a three-step process. And the first of those step is get our current procedures. So vector C pose equals to these transform. That logo procedure can wait. Now we want to get our new position, which is going to depend on our booleans. So if it is player projectile with the sun thing, if not widows something else. So if it is supplier predicted, we want it to move upwards. So we need to increase our new positon y-value. So very tiny respite time times the time. This is a way of getting our projectile moving through time currently. So dukha and use data you can use at farce. It doesn't matter. So let's go to photos that grad equals to minus projectile is speed times delta psi. Actually, I made a mistake. It's not equals, is plus, equals, sorry, plastic Apervita speed. And if we are going downwards, we want to be minus equals. So now all we need to do is set our current position. So these transform that local positon equals to pose. This way we are going to move upwards or downwards in each frame. Now to take if this is working, go to your player predicted gameObject and that deep projectile script. And it does have prior periods. And let's set this bit to five for example. And f lets us Charlie, store debrief up. And now let's click play and see if this is working. Now would you click play? You associate these periodic tell going up regards. So there we go. So before we get right into the instantiation of these privatize, uh, let's create our enemy. So just right-click our prefab, go to prefab and back completely. So this rate is unlink from your prefab. And now you can make all of the changes you want from these blueprints. So, and I mean projectile and we went to change our sprite. So let's go to lasers, this, and I'm going to go with these red laser. Now, let's move it around to place it beneath our enemy. And let's make it a little bit big. R, So 1.3 maybe. Let's see. Yeah, that's good. And all we need to do now is unchecked our East player predictable because it is an enemy period tied. Great. Now let's start our proof up and get right into the instantiation of these tektites. The way we are going to develop our shouldn't mechanic is through what is called instantiation. Instantiation is the process of creating a game object into the game. This case here needs to components of sugar and a prefab. That sugar is a signal that tells again to create the game object. In our case, it will be the player presenters should boredom. Prefab is no more than a blueprint that indicates the game, how the game should look. We've already created to brief us for both our pleasure and our enemy is Professor, indicate their components and that again opposite to have and a compare operation that those components should follow. To create a prefab, just click and drag our game object for the editor to a folder where you need to add a mechanic like this. First, you need to decide what should the instantiation or car to get your trigger, then create a prefab for the object does should be created. And finally, code it through our simple three step process. First, create the object, then give it a name and apparent. Finally, place it in the current position and activate the corresponding components. Alright, so now let's get right into our shooting method. And I have already go ahead and create a method for this shooting mechanic and added whenever we press the space key and at tick can shoot method that we are going to use right now to take if our player disabled to shoot or not because we don't want our players to be able to shoot all the time. So let's start with our check and should method. And we need to float, which are going to be some timer. So. Private float and we're going to call it should timer. So equals, I don't know. Well, actually this one is going to be 0 and the next one, which is the time limit, right where it flowed, shirt, time limit is going to be, I don't know, 3f, for example, we can change that later on. And we need also a boolean. 3-bit bull can shoot, which is going to be equal to true. Always when you want to control a variable or a feature through a timer, you need three components have Boolean to uncharged whether or not you do the axion and to float. So let's get right into our check can should method. And you need to do two things. First of all, if our Should timer is less than or equal to hours should obtain limit. We should show, we want to be able to shoot. Show can show equals to true and we want to increase our timer. So should timer plus equal 0.1 x ten at a time. But it's totally fine to use these two. Yeah, sorry, this is false, not true. We went our player only to be able to shoot whether they should timess our pass our shoe Ted limits. Then we reset our time min and then we let our player should. So else can shoot equals to true. We're not resetting our timer when he went out because we are interested in only when we should show in order to reset it, when we press Space, we end our shook timer to be equal to 0 f. And now all that is left is at our can't should variable to the equation this way. If we can show that we are going to shoot and we're going to shoot and reset our timer. Alright, so now let's get right into the creation of that projectile. So let's create a public variable which is ten gameObject to start our prefab, and let's call it per year, per time, per deck. We're going to set it later on in the spectra and now go back to your should method. So the first step to gate is actually instantiate the predator. So projectile equals to a mom. Yet actually with uppercase G, update that instantiate. And we want to use the player projectile prefab. Next, we need to set a name, an apparent Italy. We don't have to, but we are going to sew a player projectile. Great. And now projectile that transform that set parent. And we want to find out where again object. So again, fine to find any gain of WNS scene and no pleasure, very tied. So I think it was the name and now that transform, because this transform property also controls the hierarchy. And the last thing we need to do is set our predicted positive ions. So Vector3 pose to get our current position. This transform the local passivity on and now set our predicted positive. And so project that transformed that local position equals two new vector three. And we had to use our follows x. We're going to use also our photos dot y plus. I don't know, let's check it out. Let's go to our scene. And let's place our projectile here. And Y minus three, and our player is y minus 3.4. So we want it to be our player. Positon plus 0.4 f. And on the same c axis, that's our player. Perfect. Ok, so actually change your point for f 2.7 so that our played on predicted done collide. So now let's check if this is working. And now if we press the space, we should see our player shooting. There we go. And our player projectiles are being generated with the correct name and Pylint. Great. Alright, so now let's get right into our enemies shooting mechanic. And I have already created awareness and our shift method and call it on the update method and create that where variable to start our brief up. And now we are going to something new, which is called the range. So let's create a variable called chains. And above these variables UG, right? Square brackets, rains and I think curly brackets from 0 to two, for example. And this way, if you apply these line of code to any variable and you go to your inspector, you will see that your variable is now our rentable value. This way is so much easier to modify it. Alright, so back to our script. Let's code our ship method. And we are going to use something called random, which generates random numbers throughout a range. So interior random equals two random dot range a think, yeah, range. And we want it to be between T80 on, I don't know, 500 for example. We can change it later on. And this way, we can only show it if our random number is less than R, where should change? It can seem a little bit too low. But remember that this method is going to be executed between 3060 times per second. So you need to have a really wide range so that our enemies not constantly inspiring project tight. So now if we can shoot, it's pretty same as these methods. So let's copy and paste and change some values. So first of all, we don't want our pleasure predictor. We want our enemy projectile. We don't want our pleasure predator lastname and embryonic type. And the same here, NME, tides and now, and let's check if we have to bury our positions. So let's create enemy projectile on this scene right here, for example. And I want it to be right here. And our showed there is soon the 4.32 y and our predicted in zone three. So it's our current position minus 1.3. Great. Are also now back to unity less click play and see if our enemies should in R naught. And there we go. It should imperfectly and shooting chance maybe too low. But don't worry about that. We can change that in a moment. So let's change two things. Let's increase our shoot intense and lets increase both player, players and enemies project status bit too, I don't know, eight maybe, just messed up. I get this value as much as you want unless ticket out. That's so much of it that, alright, so the last thing we're going to do in this lesson is control our players projectile collision, and we want our enemy to be destroyed whenever it is hit by a player predicted. So we're going to use a method called Pretty good. I mean, if you just type on colleagues union till today, there we go. And we are going to get this method. Let's take this nature collider. And this method is triggered whenever I read body a polygon to the register I collision with these collider, which is the other game object. So we want to check if it's player predict tail. We want to call this new method called Tech Coalition on enemy. And we're going to bust the actual enemy. And we also want to destroy the projectile. So gameObject deck we go and now whenever we got hit by the player, we want our collide there that get component and not game objects, sorry. Yeah. And we want to destroy, destroying. There we go. We are going to do more things later on, but for now, we just want to destroy both enemy and periodic title. Alright, so let's get back to Unity and see if we can actually destroy our enemy. So let's aim and come here. There we go. Howard enemies being destroyed perfectly. All right, so that will be all for this lesson we have already created that were game pillars. We have both players and enemy moving and we have our shouldn't mechanic working. So thank you so much for watching and I will see you in the next one. 7. UI Creation & Stats Tracking: Hello everyone and welcome to another lesson of the course. In this lesson, we are going to create our UI. So before we jump into the UI, let's add a little thing that I forgot to add in the last lesson and it was to create that attack for our enemies. So go to tax enemy. And we're going to use the stack into our project, tell a script. But first of all, let's go to our shoe there. Gameobject that at the attack. Then click over right, apply old to apply the changes also to the prefab. And now let's go back to our projectile. Scraped and before the destroyer of statement list, check if collide there that game object, that back that equals enemy. Because otherwise they predicted is going to destroy everything including our borders. So that's great. So now let's get right into the UI and let's start by creating our canvas. So let's go to controllers UI. And you can, there you go. And you may be surprised because these Canvas actually matches the camera solution. But don't worry because if you play something here is going to look exactly the same in your game. When you develop a new UI for your game, you should first think about all of the components and that it is going to contain, in our case, it will be deployed risker lives. And again time then figured out what the unit, the elements you can use to represent those components. We're going to use text for both the time and Asscher and three images for all the pleasure lives, job done these mental process and you can jump into creating the UI, decides procedure and besotted structure, sprites, ADC. Once you've created, the only thing left to do is to make it function through a script. In this case, we need to keep track of both the players score and apply it lives. And we also need that they encounter. Since time is a really common nu i component, you will probably find a code that implemented if you just search for it on the internet. If you follow these four step process, you will find no problem, develop it any UI for your games. So let's start by creating our panel in which we are going to store everything. And let's play seat around this board are, and we're going to style this later. Don't worry if it's a little bit ugly right now. Alright, so I have already had it at this price so that it looks better. And now let's go to our sicker and m time. So let's go to text and there's renaming to start with this core. And now let's mess around a little bit with the text up down lists, set it to some zeros because we are going to change that later on with script. Let's see, let this font for example, and let's make heat white. Now, let's place it in the middle and increase the font size. Now. Let's place it on our panel. And I think around this size, I don't know. Alright, so I have already created another texts with these, and pretty much the same as the score for the time. And too little dividers, which are just images. So now let's add under three images representing the plague years and life. So let's create one and then we are going to duplicate it. So let's choose. I think there was an sprite. It was yeah, an icon of our player bat on the UI style sold. Let's get these. Yeah, that's good. Now let's riskier later little bead and that looks a little bit bigger. And you just place it there. And let's rename it to live 0. And now let's duplicate it. And let's move them around. So this one here and this one here. Yeah, that's not good. Alright, so now that we have aware UI structure, let's go to our scripts and let's create another one, which we are going to call UI and let somebody in AP. All right, so before we start with the proper code, let's prepare our script and we need to import a library which is called unity and Jane UI, I think. Yeah, Unity engine UI. And now we need a bunch of variables. So let us start with the integer, so they get a score and we are going to start with 0. And public. Public int pleasure lives close to three. Now, we need to store all of the game object that we have created. So public text, score, Public takes time. Now the three images, so Pavlik emit life 0 and the rest of the images. And the last variables we need is private time counter, which is a float, sorry, and we are ready to grow. Alright, so I have already created three methods. One for Time-Life and its core. And we're going to start with the time Now, we need a little bit of math knowledge to understand this step and don't worry because I will be explaining it. So the first thing that we need is an increase our time counter based on time, delta time. Then we need to get both is minutes and seconds. And here is the tricky part. So we need to use math. Floor. Gets the lower number more close to the number inside the brackets. So we need. To divide our current time counter by 63 load. And then we need to convert everything to a string. And if you place here 00, it gets these format. And for the seconds is pretty much the same. But instead of dividing time counter, we get a module, so to encounter and no 60. And just get it to Jewish string and CDO 0. And the last thing that we need to do is get our timer or an Army was time, sorry. So tiny that get component text from the text attribute and minutes plus novel dots plus seconds. Great, so we have already created our update time. Let's go to update live sang. We are going to use another method which I'm gonna call set life's immediately, which is going to asset three booleans. So bool, arrow, bool, life, sorry, bull, life, too, great. And inside here, all we are going to do is these life CDO that get component emit that enable, I think, yeah, enable it goes to 0. And we're going to do the same with in the other two lives. So my f1, f2 and f2. And this is so we avoid to repeat code inside here because all we need to do right now is called the method. And based on our players lives, instead of writing these three lines of code over and over again. So inside this method or we need this Ostrich and based on our player lives. So we have four cases and we just enable or disable the corresponding immunities. And with our new method, if we have three lights, all of their enable if we have no lives, although there are hidden. So let's end with our score method, which is the simplest one. So these score that get component, sorry, and get component text with uppercase T dot text equals to play at a sucker, I think I name it. Yeah. There you go. I mean, yeah, to string, Sorry. And let's place I've zeros, I think. Alright, so we have already created this structure for our UI script and time updates automatically, but we need some kind of a trigger to update lives and a score. And these two sugars are going to be contained here. So let's create two methods which are going to be public because we are going to call them through our predicted is clear. So public void and pleasure hit. And we never apply year receive is our heat. We need to decrease our current player lives. Yeah, and now. Actually let's call it on the, on the other screen. Now let's go back to our script. And, and when we hit an enemy, we want to do something else apart from this church in the enemy. We want to increase our pleasure discourse. So let's go to GameObject and GameObject that find. And we want to find our UUA that get component, UI to get our UI script and play year as core plus equal to a 150, for example. Great. And if it is not a priority or projectile, we want to check collisions shown the player. So let's copy this method and let's place it here to collision on player instead of NMI. Now, let's change it here too. And now if tack equal player, but we need to add late there. We need to not increase awareness curb bath to trigger the player heap method being great. And of course, we don't want our players to be destroyed when it received is a hit. So let's do that and now let's go back to Unity. And you need to do several things. First of all, it's go to your Eawag him of debt than App, Script and the corresponding texts and images and go to your player gameObject and at the tack. Now, to test this out, let's go to our shoot there and increase our shooting tens. So it's easier for me to get hit on purpose. And now we click plague, we shall see that our time is increasing currently. So let's see. Yeah, time is increasing. If I get hit, Apply, Your life goes away. And now if I kill the enemy, yeah, I'd wear skirts increase perfectly. Alright, so the last thing we're gonna do in this lesson is create our recovery time for our player so that it can not be heat two times so close to each other. So let's go to our players, create and create a new variable, which is going to be public. Public bowl is recovering the covarying Yeah, equals to false. And now we need to control these variable through our player heap methods. So we only reduce player lives if and GameObject that fine. And we find our layer, we get our player. I'm sorry. Our Player component is creep. And where is recovering is not true. We reduce our players lives. Now let's create a new method here, which is going to be an enumerator. And eye enumerator is a type of method which represent that our method is a coroutine. Whenever you call a function, it runs all the way to the end, executing all of the code before giving the final result co-routine instead lets you are stopped. They go whenever you want and either read or not, but the execute that code or just wait for another determinate amount of time. This action is performed by what is called a yield, which will be sent out a return statement. That's sure not then the coroutine, coroutines are really useful in games since we don't want our games to be stopped because of a large, fancy unbind execute. You're going to also use coroutine for scripting and maintain or waiting for a determinative end-to-end. For example, you may want to wait 30 seconds since your pleasure picked up the last powered up before responding. Another one when wearing off implementing that functionality is through coroutines. So when we take a heap and we are not in recovery mode, we want to enter recovery mode, then exit when the recovery time is sobered. And let's set our recovery time to, I don't know, two seconds. So just write yield, return new weight for seconds. And let's place to F, right? Alright, so the last thing left to do is actually start recovering if we get hit. So let's copy all of these and place it here. Player recover, which is our new eye enumerator. And these method needs to be called Throughout. Start coroutine. Sorry about that. And inside the brackets. Yeah, there we go. And of course decrease our player lives. Right to, that's this out. I'm going to click play and I have created two more enemies so I can get hit multiple times. And let's get hit. Did you see it that I get hit the first time and the second time? It didn't count. Yeah. That's that's good. All right, so that will be all for this lesson. We have already created our UI is core Life and Time. We have everything we need to have a simple gain. I hope you're enjoying it and I will see you in the next lesson. 8. Shield Power Up Development: Hello everyone and welcome to another lesson of the course. In this lesson, we are going to create our first power up. To create a power up usual divide your thinking process into two stages. And the power up control and the power up effect. The power up control refers to the process of acquiring and losing a powered up, usually are programmed up his activities rare pickup and update that the pleasures colliders with that triggers the activation of the power up effect and this the activity through a timer or a trigger. What effect is a proper functionality of the object you're power-up may increase some playlist starts like damage or speed. It will also activate some bundles held like a partner or a shield. Or it may even make the game harder for the player by the Poisson Muslim in Super Mario, when you have these two components, make them bone function separately and once they both work, linked them to get your final paragraph feature. In our case, we are developing a shield. This bubble it up and get started with this through a collision with the pickup. And is the activity by recipient or heat on it. Decile effect will be to prevent that layer for Lucena line from the next heat since it was activated. Alright, so our parabola is going to be a shield. And first of all, we need to create to game objects the power of pickup, and she'll object and it says start with the backup. So let's create a new empty, removed it, name it, she'll pick up, great. This object is going to spread gender, of course. And let's choose another sprite from here, power apps, unless speak these CLV or shield to the enemy, but the shelf pick up I forgot to praise. Into. There we go. So the speak, our sprite and the nesting. We need each polygon collider so that it adapts to where she'll pick up. And let's zoom a little bit to see that it is very good. Now, let's make it a little bit bigger. 1 find maybe, maybe too much. I don't know. Now that's good. And now, the only difference between this polygon collided and the ones that we have already used is that you need to take the East triggered textbooks. As you know. Sugars only affect the scripts so that when a player collides with our pick up, the player doesn't lose momentum and just pick up the field. So let's move that around a little bit. And now let's create pair shield, which is going to be a tale of our players. So that is followed. And let's call it, she'll, great. Now, the only thing we need to do here is get a sprite render for where she'll unless go to effects. And they're really beautiful. She'll, As you can see, it matches the pliers procedure and, and if you move, your player dCL moves within. Great. All right, so let's just jump into the code and let's create a new C sharp grep. Is going to be our app. And that's opening up in this studio. Right inside our pervert up is creep, or we need to do is use on triggered into 2D instead of OnCollisionEnter 2D because it is a trigger. And this rename it. And all we need to do is, first of all tick that we have collided with the player and not an enemy or border projectile in DC. So let's do pretty much the same that we have already done collider that came up debt that tack, that equals player to make sure we are colliding with the player. And if we are colliding with the player, we went to activate a method which we are going to create right now. So let us find our player game object, get our pleasure script component. And let's call a method that right now doesn't assist, which are going to be called shield. Now on your script. Or we need to do is create a public method which is going to be shield. And this method is going to Control up boolean we're going to create right now. So let's create that Boolean, Boole sealed up. It goes to False to start with, actually, let's make it publicly because we are going to use it on our I script. And all we need to do right now is we collide with the paragraph. If an hour she'll know shield up is not up. We change it to up. Great. Alright, so apart from controlling our seal Boolean, we also need to control our seal game objects. So let's create another method this time private, private boy. Let's call it update shield. And we need to first find our gameObject shield and navigate the sprite render air, gun, owning. The vote enable equals to shield up this way, if CLE sub this bright renewal is going to be also up. And now all that is left to do is control whether or not our shell has written destroyed or not. So let's go to our player hit. And now we can only get heat on our shell if we are not recovering. So it's inside here. And we want to and before we reduce our life, if GameObject that fine, actually lists all of these here. And our player API is not tap. We reduce player lives. Otherwise we make our she'll go down. So let's get all of these. And we're shield up equals to false. Great. So all that is left is place Howard update sale method on our method. And one thing that I forgot to do is whenever power-up pq ab receive is collision less destroyed, the superpower. So this joy, these, that GameObjects. Alright, so now back to Unity and don't forget to do two things. First of all, disabled your sprite render on your game object and on your she'll pick up at your script component. So now if I click play and I pick up our, she'll first of all, our Cl. I just pick it up on the enemy. Hit me. Sorry about that. Let's try it again. We go our CLAs up and this get heat contained by this guy and see if I can manage to get heat. And there we go, our Sheol wind down. We in turn recovery mode because the next hip didn't count and our lives didn't get reduce. Great. So that will be all for this lesson. This well salad I'll be shorter, but don't worry because in the next one we're gonna finish soccer game loop by making our Power Apps and enemies spawn. So thank you so much for watching and I will see you there. 9. Managing Spawns: Hello everyone and welcome to another lesson of the course. In this lesson, we are going to implement both enemies and power has spawned. There are tons of ways to develop an astounding system and we're going to use our custom class name entity. And again, instantiation process we already worked with. And the first thing you're gonna respond process is to decide what is the gain going to spawn in the first place. And that is where our custom class comes into place. We're going to create a custom object that will tell us which object to spawn in which position, and which is the chance of data specific entity to be a spawn. This way, we can evaluate just one method to spawn any kind of entity. It could be an enemy, a power up, or even an obstacle. This is what I'd like to call an object-oriented approach. It is a way of thinking in which the objects are being spawned by a higher GameObject that controls all of this system. The main benefit of using an object-oriented approach is that you have full control over what and how you want your entities to be as phone, for example, you may want to span only three enemies at a time when powered up and two obstacles. And none of them have different coordinates and spawn sense, having a higher controller that manages all of these constraints and will make your work so much easier. So before we start with all of the sponsors management, let's store our CLP cap pre-fab because I forgot to do it on the last lesson so we can get rid of the sky without leucine the blueprints. So, and the very first thing you need to do is actually go to our game controller. And let's create a new script, which we are going to call also gain controller. And let's add it to our gameObject and before we start writing the code. So again, Controller, great. Now inside our game controller script, let's first of all create tag where new glass, so public class entity. Let's give it some attributes. So the fish Burnet, the prefab, so entity. And now we need two vectors representing both arise of phi where game. So let's quickly go to our game and tick which x and y values we need to set as limits. So our Should there is on the, let's start with the x, so minus 105. So let's go right here. Reign range minus ten, I think, and five. And for the y axis is four, I think. Yeah, four and minus three, great. Four i minus three. So again, reigned for maintenance for three. Actually is four n minus three, sorry. So once we have our arranged, let's make two interior battles for x limits. And we want them to be to size. And the same for our wear. White limits. Limits equals new int This wave, when we add more typos, enemy is so much easier to control whether or not they can spawn on one position or another. And now the final variable is also renewable, which is going to be the phones chance. So range from 0 to a 100. I don't know, we can change that if you want to later. So public Po1, TNS and great. All right, now we want the script to work both for enemies and Power Apps, but let us start with enemies and then we're going to refactor the code so that it function for both entities. So let's start by creating a list of our class. So list of entity, and let's call it enemies. He goes to New least entity and we initialize it is empty. Now we need to have Boolean which is going to be very wet. Berlin can spawn enemy, which is going to be true at first. Okay, now I have created a little bit of structure in our code so that you can understand it better. So on our update method, we are going to do two things. First of all, check whether or nor we can expound a certain type of entity. And then we spawned those entities. This is not a spawn enemies, but the spawn TTS. Again in DT, sorry. This way, if you want to add more entity, let's say I don't know, some kind of obstacle or something that is not either an enemy or a power up, you can just add a corresponding laced and Boolean to these methods. So the first thing we need to do is tick whether or not we can spawn an enemy. And we're gonna control that by the number of frenemies that are on a screen. So, and the very first thing we need is public integer representing the number of enemies, which at first is going to be 0. Now, we want to only be able to expound two enemies, for example. So going to spawn enemies equal to num of enemies, less than or equal to, less than 22. This way, we can only aspire enemies if there are no enemies or one enemy. All right, now we are going to espouse our entity and let's start with our enemies. So first of all, we need to select which entity we are going to expound based on our list. Because when we add more enemies, we need to select if we want to spawn one enemy or another. So the first thing is to get an entity selector, which is going to be a random number generated through our range, going from 0 to the number of enemies. We have enemies that count, which return the number of elements and database. Right now, we want to do the same that we have already done. So interior random, ie, close to random. That reigned, that, I mean from 0 to a 100, or sorry, from 0 to a 100. And we want to only found our enemy if randomness is less than or equal to our enemies, that our enemies on our entity selector that spawned tins. And if we can spawn enemy, great. Alright, so now that we know like we can expand our enemy, first of all, let's increase our number of enemies. Then we need to instantiate our entity and we have already done this. So remember the three steps. So first of all, enemy equals to GameObject that instantiate. And we are going to use the prefab is stored in air where the game object attribute on our entity class. So we need enemies with our Entity select tar, and we need the entity editable. So now let's give it a name and a parent. So new enemy dot name equals two. Let's call it NMI. Nmi, last number of enemies minus one, so that the first enemy is MEC row and the last one is enemy one. And then let's give it up parent and transform that parent, I think yeah, equals to GameObject that find. And it was enemy. Yeah, that transformed, that, that transform. And the last thing we need to do is position our enemy and we need to generate some coordinates are based on our x and y limits. So we need two integers. So run no, actually we can use float, so yeah, let's see, it floats. So R1 known equal to random dot rained. And inside these brackets, and both limits are going to read these two values on our vector. So the first one is going to be our enemies on our Entity select tar, that x limit and the first positive and our vector. And now all we need to do is pretty much the same, but with the second element on the vector. Great. Now, the same for our y-axis, thus using aware way limits. So here it is, y, y, y. And once we have our two coordinates, the ask right, new enemy that transform, that local position equals two new vector three. And we use these coordinates as the arguments for the constructor. So random x and y and c axis, I think it goes minus two, but I'm not sure. Our noise is actually 0. Great. So 00 I am, I just noticed that we didn't right here that corresponding usage of this class. So just write system dot csv civil, Yeah, so that we can see these glass on the spectrum. All right, so now let's get back to Unity. And as you can see, if you open this up and increase your enemy size, you will see it your first telomere, which represents your first enemies. So let's, first of all, let's check our aware. Pretty far is updated, so just click over right and apply all unless go charging controller. And let's add our pretty fab to start with. Now, let's set us pond chins 2, 10% maybe I don't know, we can change that later and now we need to know our x and y limits. Our excellent MIT is going to be the full screen and our y limits is going to be one number, which is going to be four, because I want to only be able to respond to these type of enemy on the top of the screen. So we're limits is to size. And we want them both to be minus four. I mean, for yeah, for an for an hour x limit are going to be poor, right? So the first one is going to be minus ten and the other one is going to be great. And before we test these outlets, change how our sponsors, because they think a 100 is two little less actually make it 1000. So that our again thus in, constantly spawn enemy. And now you click play, you should see that your enemies hardest spawning correctly, so that we always have one enemy and two enemies. Great. Alright, so the only thing left to do for our enemies spawn is actually less. Increase this number to three so we can have more enemies unless you go to our UI, I think. Yeah, unless create another method which is going to be public cultural, and it's going to be enemy. Hit. Great. So actually we are on our UI script, sorry, it's on your gain controller scripts or let's go to ng-controller and let's create another method here. Now let's make it here. Yeah, and it's going to be enemy down. And all we want to do right now is decrease our number of enemies. We're going to do more things later on. And we want to call that method for nowhere projectiles kid, whenever we hit an enemy. So before we destroyed that enemy, we want to find our gameObject gain controller, gain control to get our game controller script. And we want to call our enemy down method. Alright, now you click play. You should see that. Three enemies spawn and then when they kill one of them and other one spawned, yeah, respond, sense are a little bit messy, but don't worry, we are going to take care of those when we started polish in our game. Alright, so the last thing we're gonna do in this lesson is refactor this code so that the score for both enemies and power of refactoring is a really common process within programming. And it consists and the modification of the structure of the code without changing the original functionality. The main goal of refactoring is to make your code more readable and more efficient. This can be a see-through several procedures. Some of the most common ones are simplify and a method by dividing it into several little functions using Kristen crisis for us, for TV features and create that global methods to avoid code repetition. In this case, we have a method that is spawns enemies. And we want this method to work for any kind of entity in the process that we are going to follow to refactor these methods so that the Pantheon for both enemies and power-up is to take each line of code and CVDs using a variable of our game controller script. And if it is the case, we'll replace that variable with a method argument. This way, if we went to change the entities that our method is bone-in, we just need to change the arguments instead of writing all of the code again, making the method both more readable and more efficient. Remember that refactoring is one of the best practices within programming. So usual try to refactor as much of your code as possible. So let's start by copying all of this method and let's change the name to spawn entity. And now let's go line by line and making some arguments. So the first thing we do is set our entity selector. That's totally fine, but we use a list. So let's create a list of entity and oh sorry, and treaty. And let's call it list for example. And here we use the list, how many times, all of these times. So just control D to select all of them and paste. Great. And next sustainment, we use Heron known, which is totally fine. And here we use a boolean. So let's create another argument Boolean unless colleague controller. So kinda spawn enemy is only used there. So just copy and paste. Great. Here. We use a number of entities. So let's check whether are not the disarmed enemies. So another volun is enemy. To differentiate and we want to, if is enemy, we increase our number of enemies. Otherwise we increase our number of powered apps. And let's create that variable right now. So public int num, power apps. Great. We need now a new enemy. So let's change the name to New entity. And this is all perfect. And the name is going to be either enemy are powered up, so the sustainment needs to be controlled also by our is enemy booleans. So if it is enemy, We do. These two things, these two things. So let's copy and paste here. And otherwise we do the same but with our powered apps. So you Entity that name is you've got to fire up a number of Power Apps. Weight. Here is where apps and weight. And for the rest of the code, that's George Sally, fine. Now we can get rid of the spawn enemy method less create another Boolean for our where our apps so volume can spawn poleward AB equals to true. And now we want to take, also can span power up and we want only one power up to be on the screen. So if it is less than one, now we need to call both methods spawn entity to times. And the first one is going to be for our enemies. So we went our enemies with our kinda spawn enemy and true, great. And now we want to call death method again fora where power apps. So let's create another list here, our list of entities, but this time is going to be our apps. Great. And let's call this method with our apps. Can spawn forward up and it is not a poet. This way we have these lines of code that worked for both enemies and Power Apps. And if you want to add more entities to your game, it's so much easier. And to end up with, we only need to also indicate whether or not powered up has been destroyed. So now matter of power ups here power down. And let's go to our power up method. And before we get out where our up, before we destroy, let's find our game object that define ng, ng controller. Oh sorry. In Controller component to get our script. And let's call our power up down method. Great. Now back to unity. Let's create our first powered apps. So our powerless list is going to be one size and the first enemy is going to be our she'll pick up. We wanted to have a spawn tens of I don't know, five maybe, I don't know. And for the x limits, we want to be able to spawn on the whole screen. For the wide limits. I wanted to only phone through there, tom, But only on the u2. Maybe, great. And now you click play. You should see that our power ups and enemy out of both spawning. So here r is our enemies, ikea R1 and another one is found. And now our Cl is here if I pick it up and other one is bone and great. So that will be all for this lesson. Don't worry too much about Lamy in sand is bone tens and so on. Because when we start Policy and we are going to get those values, correct. Thank you so much for watching and I hope you are enjoying making this game and I will see you in the next lesson. 10. Creating our Main Menu & Game Over Screens: Hello everyone and welcome to another lesson of the course. In this lesson, we are gonna create our main menu and our game over screen. And the process that we are going to follow to create both our main menu on our game over the screens is pretty matter. They're seen as we develop in our UI. This junior scenes are not playable, but transit around. This mean that they both should lead to or believed it from the main level is seen to create any kind of transition. Unless scenes, you need to first follow the four-step process that you follow into the UI cation. Then you need to link your new instincts to both the main playable a scene and to each other. That is what you want. This union can be achieved through a lot of different metals, but we are going to use bottoms Ludens in unity comes with a feature that allows you to attach a method within a script, a trigger that the but'm producers when it's this way, if you have a but'm dot shall leave to the main level, you can create a method called Play button pressed that we've changed the colonists sins to the main level of sin, and then link that method to the button activation and other common feature within game over the screens is to show our record of the players scored in the last game. So at this feature, usually don't destroy it on lung function on A-star gameObject dysfunction prevents under specific game object from being erased when a new scene is loaded. This way, you can start your players Oscar into that game object when the main level conclusions and afterwards lot data scurrying to your new game over the sin. All right, so that said let's go to our scene folder and let's create two new scenes, which are going to be Menu and GameOver. And before we start creating the appropriate structure of these scenes, do you need to do a little thing which is to go to, I think it was BuildSettings. Yeah. And now you need to open up your scenes and click at openness scenes. And you need to do that for the 3.5 then this is so that I won't gain knows we just since R B level and which are not. So we can work with this intensity and on the script. So we start with our Menu scene. So let's go to our main camera, this copy and paste it on our menu. I have already raised the default cameras so that our resolute journeys completely fine between his scenes. And now we just need to follow the same process I we have follow without Wear UI. So let's create a little bit of structure here. Alright, so I have already go ahead and create the olive where many scenes are and I have added some texts are limited means, but the important part is you make sure to add the two protons that play Buddha Monday exit Buton, all of the rest is more optional. And now that you have everything, let's go to our script folder. And there's great C-sharp script for our menu. Alright, so inside aware menu screen, we need to add threads to libraries, one that we have already worked with with the Unity engine UI. And we also need unity gain that seem management to control our scene. So let's now create two methods which are going to be, I think it's needs to be public Latino shirt. So let us call it play bourdon breast. And the other one is going to be public void exit Fudan pressed. Great. Now all we need to do inside these two methods, seats controller where a scene. So to load a new scene, you just need to do a scene manager that load, load the scene, sorry, and inside the brackets, the name of this scene, soul level. And for exiting your gain, you just need to go application that quit. That's, it's as simple as that. Alright, so now inside of Unity, you just need to, first of all, at your menu script to your UI GameObject or comebacks object. It doesn't matter too much and now go to one of your buttons. And down here you see onclick, which is a method that links the triggered that they built on producers with Hmm methods. So you click plus and here you can place your UI gameObject. And here you can select your menu, which is your menu screen. These are a bunch of default methods and you just search for your play button pressed. Great. And now let's do the same with our exit Bourdon, and you just click and drag and then select the corresponding method. And now I love this levees to test this out. And before you start freaking out about why this doesn't work, I just want you to note that the exit boredom is not going to work unless you build your game but not worry, trust me, the obligation that quit method works. But if you play your play button, you will see that you get right into the game. Great. Alright, so I have already created pretty much the same on Nowhere GameOver that scene. I have added the three buttons. You can add more items you want. And I have already linked all of them. Try where methods so we can go from the game over scene to exit indie game play again or to the main menu, I have created another script, which is pretty much the same as we're menu script. And I have created a panel in which we are gonna register our last game statistics, both time and a score. And this is where our GameObjects stats communists to play. I didn't know you remember it, but on the first lesson, I think we created a game object name stats that I told you we will be using later on and now we are going to use it. So, and the first thing we need to do is create a script for that game object. So let's call it starts and this script is going to be super simple. So just opening up and we don't need any of these methods, we just need to variables 140, it's a stat so public int, scar and poverty, extreme time. And now you need to call it onDestroy, allowed to function within the awake function. So you're going to also use it on the start vast. It's better to use it here. So just click, don't destroy load. And here these dark game objects. This way, if you now go to unity and you add duress kit to your stats gameObject. And now let's play a game and let ourselves be killed. You will see that he insight here is our ethos game objects. These objects within the level hierarchy are going to get destroyed whenever we lose the game. But the dawn destroying onload, this statistic are not. Alright. So the last thing we need to do is actually make possible to go to our game over scene. So let's go to our player hit method within our UI is script. And after we have reduced our players life, let's call a new metal. We are going to be a mobile app. It's lowercase g. And now let us go to carry bit boy came over and we need to do two things. We need to first of all, import our libraries. Sorry, I forgot to mention it in part your sin management and library. And now we need to do two things. First of all, we need to pass our US currentTime to our stats gameObject. So gameObject, sorry, game object. That fine. Stats get component starts. That score equals to play soccer. I don't remember the name, sorry. Yeah. Player scar. Great. And now pretty much the same for our time. So the same but within our time on determined I think it's text. The I don't know if it is compatible. I don't think so to Stringer, everybody got great. And now all that is left is call our GameOver seem. So let's go to seem manager that load the scene game over. And of course we only want to call this method if we are out of life. So if player lives play, so sorry, layer lives equals 0, then we call our GameOver method. Great. So there could be all for passing our stats. Now we need to receive our TA starts on our game over scene. So at the end of the, of the star, sorry of the scene, we need to set a record. And now let's create that method down here. So rebate, void, set, record. And now we need to do several things. First of all, we need to game objects to represent a both and this core and the time. So public test and public text. Time, great. Alright, so inside our separate Gore method, let's first of all check. I mean playing our game object, the stats, so game of the desktop, SQL to Game of that fine starts. That's great. And now we need to set both as current time. So these dot core dot text equals to start that get component starts to guest our script. And now that core, and I don't know if we have to cast it to string. I think so. That's a string with five zeros, for example, weight and now pretty much the same for our time. So this.tab 2.txt is that good component, is that score no time. Great. Now to string, we don't need any argument. Right? Now back to unity. Just go to your game or Birra scene and make sure that you add your text game object to your script. So we need inside our panel time. Oh sorry, time is down and scar, right? Alright. Sorry about this that I just notice it that we don't need our and to string casting and we need to actually add the words. So it's a sin instead of Justice Corps score equals to this class. However, scar components are now time equals to pretty much the same rate. And you also need to change this, sorry, and it's not tying that to a string. We actually need the time that they get component text objects within the text property. And now pass these to, to a string. Because if not to do are going to get the actual time worth inside your eye starts a game object. Now, everything should be fine. Alright, so does this outlays go to our UA scraped unless the valuable thing to make our life easier. And it's going to be if we press a key. So if input that get key, key code, I don't know the, the P code, for example, we are going to call our GameOver methods so that I don't have to be causal allele getting here to take if this is working. So now let's go to unity click play, and let's kill an enemy to see what the score is working. Let's see if I can manage to get, yeah. And now if I click on b, we go to our game over scene and we see that we have both our time and a sucker perfectly bean record. Right? So before I forget, let's get rid of these, of this code so everything is clean and that will be all for this lesson. I hope you're enjoying it and I will see you in the next one. 11. Adding Two New Enemies: Hello everyone and welcome to another lesson, not the goals. In this lesson, we are going to start making our game more interesting by adding two new enemies. The personas of adding new types of happy established entity goes through three steps. The first step is to decide which features are common to which type of entities. Then think about which ones are unique to specific type. Or if some of the common ones need and tweak based on the entity type. And the last step will be to make it all function. For this last step during find useful the following flow process and differentiate the different types of entities. Second, isolate the functionality you already have heard you're pretty established entity. Third, prepaid ACOTEX structure in which your entities specific features are called through the same global method. And lastly developed with both common and a specific features. In this case, we are developing to new names and ufo and our rocket for the common components, these two new enemies and our current shooter enemies said the featured of damaging the player when they collide with it. Also the UFO and shoot their enemies both needs to change directions when they collide with other enemy. And lastly, both the UFO rockets said the fact that they get district when keyed in our continuing with the specific, we have had different path correlates enemy. We also have this shooters have entity to shoot projectiles. And finally, the fact that our rocket enemy gets destroyed when it hits another enemy. Now, all that is left to do is make it all work. And the fiber steady flow process, we are going to follow Gurobi First. We will create our new enemies prefab based on our shoulders and differentiate the different enemy types through that enum variable. Second, we will oscillate. There should add movement and collisions are the known functions and the shooting method with a Boolean variable set, we will develop a starcraft for both movement and collisions that called the corresponding function based on our enemy type variable. Lastly, we will code both common and a specific features. So this is a pretty important lessons on one of the most fun of all them all. And let's go step by step. And the first thing we need to do is create our new prefab. So we are going to create two new enemies and new UFO on-air rocket. So let's first of all play some chute there and let's buck the brief up so we can start. I'm from a middle point, so let's rename it told us is that with a UFO. And first of all, let's say dV for looking. So there's go to sprites in G. And this is how really cool-looking UFO. And I think it's Saturday. Yeah, it's making just one. And this reset out where polygon collider so that eat other apps to outweigh UFO. Am, buddy, great. Alright, so we will take care of our enemy script later on. So for now on let's etcetera, where you have four brief up and let's back it again so we can. Great ever rocket enemy. And let's choose Sprite and I think it was enemy, I don't know. Yeah, that one. I like that r1 less making that and I want to rotate it on the y-axis. I don't know. Let's just use this tool and you can rotate with rotation tool. But if you hold Control or Command on Mac, you can rotate more in a more fixed way so that it looks bigger. And now let's make this guy so much smaller because I want these guys to be spawning alot of then on the bottom of the screen. So now all that is left to do is reset again our polygon collider so that it adapts to the new sprite. Great. Alright, so now that we have all of our three enemies, we need to divide the process into two steps. First of all, we are going to take care of the movement and then we're going to take care of the collision. So let's go to our enemy script. And the very first thing we need to do is create some kind of method to divide our three types of enemy. And we are going to do that through a type of variable which is called enum. So let's create public enum and let's call it type. And you need to first say all of the possible values for our variable with, which is type, type. Actually let's name it enemy type for the sake of our understanding. And we want three possible values. And we want to be able to create that shoe there. And you have four and a rocket is come on. It's common practice. Override the enum values in uppercase, but you can go to lowercase if you want. And now all that is left is create that type of variable based on our new type. So public enemy type. And now type. Now you about to unity. You will see on all of your enemies that our new variable has appeared. So type, this is a shooter and now you can just click and select the corresponding type of enemy. Alright, so first things. First, let's do allele thing to increase our game performance. And it is to create a new variable, Boolean, which is going to be kin shirt, which is going to be, actually, let's leave it empty and we need to set this variable. Can shoot equals two enemy type. Now, type, type, type, type, type equals two enemy type. That should it. So that only our Should There is able to shoot. And now we need to control these methods within these new variable so that it is not being secured on the UFO and rocket GameObjects. Okay, great. Alright, so before we jump in to create a new movement methods, I have substituted I wear a move shoot air method actually. And the method that is called on our update method. We treat that calls the corresponding method based on where enemy type. So let us start with our mirror, move. Ufos, hurry, and we need to create a new variable which is going to be a Boolean, is going up, indicating whether or not our UFO is going up or not. Great. So now we need probate below the vector called white peaks to terminate whether or not we surely start going down. And we are going to set these values on our static methods. So after we decide is if our emic and shoot or not, we are going to say float. And this is going to be a vector which is going to have different value within the position of our enemy. Sort of got that. And now we need to get our transform that local capacity on, oh sorry, local Post-It and that why we are going to add to Boeing F, for example, and no contain down later on. And now all we need to do is pretty much the same bus. But trust thing around the y axis. And position that, quite sorry. And all that is left to do. Why peaks equals two? You have four peaks, right? And before we started with the proper method, and we need another Boolean which is going to tell that if we have reached the peak of naught, so v equals to false, right? Now let's go to our MOOC fo methods. And first of all, let's get our current positon force equal to this transformed a local procedure. And now we need to divide our method into the two axis. And let's start with the x axis, which is something we have already were with. So it's sound familiar. So if we are when ri, we are going to add force, force, I mean RV at four, sorry. The force. And we are going to add force based on vector two variable and our excess speed. And I want our UFO 2B is lower than our shooters. So let's multiply these by 2 and on the y axis. And if we are not going right, we need to do the same, but with minus XS be great. The next thing we need to do is actually do the same bath with our Y axis. So less control it with our, is going up very well. So we are going to, we want to add a force based on again vector two very well, but this time 0 and the x axis and y speed on the y axis. And actually, I forgot to tell you to actually create the wave speed. We can create it right now, right? So we have done before the same for our downcase. So RBF 4's, why is it minus, minus a bit? That's right. Alright, so the last thing we need to do, find out where the UFO movement, these control our reach peak embeddable. So first of all, if our read speak very well is activated, we need to chain Tower is going up value so that when we reach the upper peak, we start going down. And when we hit the down peak will start going up. So this is going up because NO is going up. And now inside our movement, let's lay some brackets and let's control our variable. So the way we are going to control our rates vary voltages through our current position and now we're white big vector. So reach peak is equal to our current positive. Current positive and on the y-axis being greater than or equal to our first value in our Wikileaks vector. That is, if we are going up, if we are going down, it's the same but with less than or equal to our second value. It's as simple as that, right? So that will be all for our mu move UFO method. Let's quickly do our move rocket because it is so much simpler, so we just need to add a force on the y axis. So new vector two. We need to see it on the X axis and Y on the Y axis. Right? So there's this movement. Let's go to both our prefab and let's add some wave speed. I want this to be 0.2 maybe, and the rocket speed is going to be a little bit faster. So let's place it there. And now let's quickly lay some rocket. And I knew UFO to take a0. This is working or not. And yeah, everything is working perfectly. Alright. Little thing I want to do right now, I just notice it when I test this out is to control our is going read variable based on where spawning positive and so is going right is going to be equal to our change form, that login procedure and that x greater than 0. If we're smaller than 0. This way, if we, as shown on the left side of the screen, we are going to start going right, and otherwise we are going to go left. Great. So the next thing we are going to develop is our coalition management. So I have created some methods for all of the collision that we want to reach there on our enemies. And now all that is left to do is develop each one of these collisions. So let's start with our player. And whenever an enemy hit the player, we want that enemy to be destroyed and our players lives to be reduced no matter what the enemy type is. So are we need to do is first of all, M of debt that find UI to get our Eli screamed and we need pleasure hit I think, yeah, player hits. So we reduce our players lives. Now, we need to Troy the gameObject. Great. And we also want to notify our game controller that an enemy has been destroyed so we can expound another one. So again, controller component, again, controller, sorry, Control-A enemy down. Right? Now for their collisions with other enemies, we want our rocket to be destroyed, but the rest of the enemies to just change the expense. So if our enemy type, type equals two enemy type dot rocket, I want to destroy this game object. The game object. And otherwise, I want our, is he going to ride variable to be its opposite. Great. And now for the collision with walls, I want where UFO and rockets, enemies to be destroyed about that, where should that enemy to change the experience? So we just need to do pretty much the same as before. So enemy type, this time should there we want to, our variable is going to be equals to its opposite. And on the rest of the cases, I want the enemies to being destroyed. Back to unity. We need to first add the tag for the borders that right now have no tak. So as you go to tack attack and I think an emit safe, right? And now let's let, all of them were as great. Alright, so now let's test this out. Unless great, another UFO here so that they both collide with each other. And if everything is working, this rocket should go all the way up until he reached the border when it is going to get destroyed. Our shoulders enemies should not get destroyed and our UFOs and change direction until they hit a wall and then be destroyed. And if I hit any of them with my player sprite, I should get my life's radios. So where should that, according to our rocket, I mean, God destroyed the UFOs are also changing direction perfectly. And now if I hit one of these guys, yeah, I got hit and my life's getter radius. Great. Alright, so we are almost done with our new enemies. We just need to add them to our gain controller is found in system. And as I have told you before, this is so much easier because we have to already take care of doing the work before. So all we need to do is increase our enemies list size to three, and now we have our two new elements. Let's add the brief apps. So you have for an rock kid, great. And now I want a rocket to be the most enemies spawn. The initial data and the last one, the UFO. Let's place this shooting, this content, sorry, 25. And these shooter tends to eight. So now I want our UFO to be able to respond through the whole screen on the x-axis and on the y-axis, I want it to only be able to spawn through minus two. I mean two and minus two. And for the rockets and the same on the x-axis, I want them to be able to spawn on the whole screen. And for the y axis, I want them to only be able to spawn within the minus x3 value. So now let's go to, let's go to play mode and see if they responding currently. So we have assured there. Now arrogate cats as Boehner has hit me. Don't worry about that. We will face that thing around and see new iPhone phone. Yeah, it's not a spawn in the I I know, I know y. So let's do a couple of things here to fix some bugs. And the first thing that we need to actually tell our gain controller escape whenever an enemy has been destroyed. So here we want to tell our ng-controller that autonomy has been destroyed. So before we destroy the enemy, we went to call it. And here pretty much the same as one thing. And the other thing I want to do is prevent our enemies to take our power apps. So let's go to power-ups and we want to only destroyed this game object if our collider that TAC is equal to D players. So let's place all of these inside our if statement. Great. All right, so now let's test this out again. And now everything should be working fine. We have assured that Anna UFO, if I kill the UFO, are organise bone and should there. And now they're rocket has collided with his shirt that under rocket has been destroyed and they showed that has not. And yeah, everything is working as we affect it. So that will be all for this lesson. Our brain looks so much better with more enemies. And the next thing we're gonna do is create new power-ups so that this game looks pretty, pretty awesome. So, thank you so much for watching, and I will see you in the next lesson. 12. SpeedBoost & ShootBoost Development: Hello everyone and welcome to another lesson of the course. In this lesson, we are going to create two new power-ups, Nebraska that we're going to follow to gauge our two new power-ups is pretty much the same as the one we followed when creating new enemies. We just need to combine it with a power up thinking process we talked about before. Let's start with the creation of the power apps we're going to create. I should boost and a speed boost. These two new power-ups. Forget that debate is through the collision of the player with the powered up pickup and get the activated through a timer about what up effects will be to increase their pledge to the speed for the speed boost, and to decrease their suit in limit for the shoot burst. Now that we had the trigger and the effect, we need to code both effect the status and control the activation of one another through attain mirror where you. So now that we have our new power apps, we just need to follow the process that we learnt in the last lesson. Our three power apps have in common that they all get activated through a pickup and both this bit burst and should get deactivated through a tamer. And for their specific features, we have the fact that only the seal Power Apps gets deactivated when receiving a heap and that these power-up affects and instead land gameObject apart from the player. So to end up with, we need to code the whole process. First. We will create and again use, I mean, unbearable to divide our power-ups types. Second, we need to create new methods for both this bit boots and shoot boats powered apps, because we have a rate taking care of isolating this CL code that we are going to create a method that execute this old power ofs but only control the one that is active. And lastly, we just need to go both their stats management and attainments. So the process of this lesson is pretty much the same as the last one. And the first thing we need to do is actually create our new power-ups, speak up, prefabs, soulless, plays a CL and its bucket. And now let's start with the should lose. For example, unless colleagues should boost vk app. And now, as you can remember it, you just need to go to your sprites and T like Dan, you're a sprite and reset your volume collider. So let's pick up up our app. We're going to take these bold and now just clique in the polygon collider. Oh sorry. But you want to cry there, reset and Is Trigger. Remember to check the box. Alright, so once you have your new briefs, go to your power-up is script on this crate down there in embeddable, which is going to be called powered up tiny plan. We're going to assign our three values which are going to be sealed, should boost and spit lowest weight. Now we need variable of type, our app type which is going to eat Thai. And now all we need to do is assign the corresponding values on all of our power apps. Alright, so the next step will be to divide which method of our playlist we are kerning based on unaware type variable. So let's make our street. Is going to have three cases. So the first case will be powered app tied that in which we are going to call our seal method. Our second case is going to be powered up books for the sample. And the default method will be the speed lost. So now we need to change this line of code inside where CLK, and now all we need to do is change the method that is being called in its case. And these methods doesn't see it right now, but we're going to create them in a second. So now this one is, should we use and the speed boost, boost. Alright, so back to our players script. I have created two new methods for the activated Dionne of both this should boost and a speed boost. And we need some variables as a timer. So let's create junior flows. First, load, speed, boost timer equals to 0, f, and private flowed a speed boost time limit. This is the same structure as we use with our limit. And let's actually set it to, I don't know, 30 for example. And now we need the same for our should boast. Alright, so once you have your order new variables, let's actually make them both ways than their corresponding obtained limits so that our player doesn't start with their boosts activated. So 21, great. Now, when we want, our power has to be activated. All we need to do is set those variables to 0. So this should boost timer equals to 0. And this should boost speed, boost timer equals two. Alright, so now we have taken care of the activation of the power ofs, and now we need to do a simple timer. So let's start with this should boost and we want, our suit was timer is less than or equal to our, Should we obtain limit? We want to increase how, where should lose timer. So should we stay milk glass equal? And let's go to 0.1 times ten, the datetime, time, delta time, Great. And otherwise, we want to do something else. Now, if we are inside this if statement, we are inside our should boost the state so we want eyewear. Certainly me, it should limit as it's called, should obtain limit. Think. And there was this, let's take it out and should take limit success. So let's set it to have 3f. And otherwise we want the to be 66. And now pretty much the same for our speed boost methods. So speed was dimer less than or equal to S BET boasts a speed boost dine limit. And we want to do something, if not, we want to do something else. And now first of all, let's increase our timer so. Plus equal 0.1 F times time, delta time, right? So if we are inside our speed boost state, we went to increase both x and y, they spit, So let's increase it to two, I think is going to read too much about sanely IT related also to F. And if not, we went the default feed, which is 0.8. Great. Great. So the only thing left to do is go to our update method and create a new method which is going to be pretty bit Boyd update. Oh sorry. Date went apps. And it's going to call our three methods. So update, shelled, update should boost and update, spit those. And now we need to replace these updates. It'll cold for our update power apps. Right? So before we start testing the South, I think these values are not exactly the best. So first of all, lifts increase our default should limit to dabble. And now let's set the actual should boost estate to six and the speed is going to read too much into Fs, or Let's go with 1.2 for example. And now let's test if this is working. Alright, so I have lived these three power apps. So let's start with our Should worst. I'm pressing the space bar as fast as I can and no fake leak is when I got to shoot more projectiles. So this is working perfectly. We shall tweak those value, but don't worry, we are going to take care of that when we start polishing. And now if I pick this pit bulls, right now I can move this fast. And if I pick this post, I can move much faster. And this value is pretty, pretty good. Great. Alright, so the only thing left to do is tell our again controller to also spawned these to power up. So let's integrate our where, our Power Apps list size and now these two elements, let's place the prefab. So should go standards pit bulls. And I want them both to be able to spawn in the same x and y values as our she'll Picasso that's already thinking cared off. And now I want the speed boost to be the most common one. And the Cl2 beat the less when we go since their most powerful or all of them. So now if I go to the game, let's pick it up. And now I know they're powered up is bone and let's see if SPT is bound, but yeah, speed boast. And before we wrap up this lesson, let's do a little thing which is to make R where power up down method occur routine so we can wait for our current power up effects to last out before we spawn another one. So public eye enumerator, aware up, down. And as you can remember it, we just need to yield. Return new weight for second. Oh sorry. New, wait four seconds. Unless wait 30 seconds. And they angry the Greece where num of Power Apps. Great. Now let's get rid of these methods. And I think this method west column the Powered Up Script, yeah, and now all we need to do is add the start coroutine co-routine to these method calling. Now back to unity. If you click play and now you pick up power up, you should see that another one power up dots in this bound until our Korean powered up last for almost 30 seconds, right? So that will be all for this lesson. I hope you enjoyed making this game. We have already taking care of the whole game loop and all that is left to do is actually make our game looks better because we have not animations, herbicide affects our music and so on. And I hope you had a cycle because this is one of the best parts of game development, and that would be all. And I will see you in the next one. 13. Polish First Stage: Hello everyone and welcome to another lesson of the course. Today we're working on a really important stage of any game development project. Polish policy is the process of working on what we already had her making it be an overall better experience to understand the importance of policy. And let me introduce you to the bilateral rule or the 80-20 rule. But it is a concept introduced by we'll credibility in 1896. And the status that 80% of the results come from 20% of the sources. Even though this theory were certainly made to understand global finances, it is applicable to almost everything in life, including gay development. When you work. And again, 80% of the final product comes from 20% of the process. And almost half of that 20% is policy. And we're going to work on your policy and process two teams, one right now, and another one just before we build our final game. Right now we have again but works. We can move. Should we have three different enemies and Power Apps and we have our gained looked completely closed. Notice time to polish, vox, monetary stance, and overall make our game feel so much better. You can polish as much as you want. But I'm going to read you a little tour to what I have done with our current game. First, I added a feature that other different score based on the enemy type. An, a player kills and enemy peppery. Ok, tell escaped cholera method within the enemy script, which tell us how many points you will deploy your gate. Second, I have attained their core routine that make the game to wait 30 seconds is the player picked up a power up to span another one from the power app is script to the gain controller script. I haven't done this because you need both the method which started the core routine, and they won that these executing it to be alive, well they're coroutine is waiting, is where we start the unexecuted the coroutine controller script. I can also attaining that data.dat timer from plus equal 0.1 f two plus equal one f. Sorry about that. Third, I have that just severed or numeric values such as a spirit tensors and the shielded emit. Fourth, I have added a feature that prevents enemies for an responding right into the player, causing an Eastern kit by ticking even degenerated procedure is next to a player and if it is against tricking, it added a little bit. Finally, I have changed as much of our code to pray, but the most important modifications where unify in both x and y, you spit into player speed and making it private. Again, controlling it with a public, either speed and a public boosters speed, making gunshot public and getting rid of ethos somatic value, making this showed their excellent Ms. private, I'm pretty finite. And finally, main key players score, prayer, lives, number of enemies, and number of power-ups, rabbit. We thought of this changes. The defendant is guilty or not at all. But remember that we are going to continue policies. Lay dead on. Feel free to keep making changes before you jump in 20 Mason and effects. I haven't enjoyed these lesson. Thank you so much for watching, and I will see you in the next one. 14. Animating Our Game: Hello everyone and welcome to another lesson of the course. In this lesson, we are going to get a game, animate it. So this is a pretty dense lessons. So let's just start with the player so I can show you everything you need to know about animation and then you're going to spin. As much of your time left, you weren't on the others animation. So let's go to our player game object and let's add an Animator component. And he may tour. And Animator is a component that lets you control the state machine associated with any specific game objects. Animation. State machine is formed by two elements, the status and the density. And in this case, the status of our state machine will be our animation clips. And then CTOs would be the conditions that deciding which clip our GameObjects should be. Let's just start by understanding whether the animation clip and animation clip is a set of key frames on one or more components of our GameObjects range that no more than an association or added value of a specific component with a fixed instance of time. For example, you may have two key frames in your game objects, x velocity on one of them, that, that your images should be in the CDO exposition on the second number two. And the other, that is sort of be on the Forex position on the second number four, when more than one gift Amy's graded onto the same property, we think different times and animation clip is formally evaluate effective for both components will gradually go through one value to another in the amount of time that jerky frames sauropod disassemble, your object, will gradually go from c to x. For x in the interval of two seconds starts in a second, an Indian and second for the other component of an animator at the set of term sheets in between a state. Transitions can be automatic or manual. Making that entity on automatic means that you will set an intense duration and exiting time, which will produce the final transition between states. On the other hand, making atrocity and manuals means that you can constrain our gameObject to go from one state to another. We some conditional sediments like Booleans or triggers. That process I recommend you to follow will be two fish grades, all of the animation clips, and then form all the videos. You can animate pretty much similar visual component that are game objects. But since this is a whole discipline which usually takes up a whole team of developers to create. We're going to stick with basic animations. That said juicy, that animating your game is one of those things that make your games also miss this great. Okay. And now let's create the actual animation. So two great animation, you just select a game object, you can even police are brief up into a game. And you go to your animation windows and click Create. Now, we go to our anemia, I mean assets folder and create a new one which is called animations. And now let's create another one for the play. And we're gonna start with the evil animation. And for naval animation, we're going to modify our player. A scale. Let's play this game. And I went our pleasure to get bigger, stay a little bit bigger, and they get smaller. And those two changes need to be as fast as possible. So let's place a mental keyframe in which we are going to place our player maximum scale. So 1, fine, maybe we can reduce it later on. And now I want to go from the normalised scale. For on the new scale, fast soldiers plays the keyframe that starting just next to the new keyframes. So the changes fast and now let's place it here. And I want all of these tend to stay on a bigger scale. So let's copy these keyframe and place it here for example. And again, our keyframe, great. And now if you click play, you shall see. Yeah, that's, that's good. All right, so now we only need to tweak this a little bit. And the first thing I want to do is to make the changes faster. So let's plays the keyframes closer to each other. And let's click Play. Yeah, that's pretty good. Actually, let's make two things. First of all, a little bit faster. Maybe I don't know if this is going to look good. Yeah, that looks good. And I want this scale to be a little bit smaller. So 1.2, maybe 1.2. Let's see. 1.2 is perfect. So now let's get rid of these keyframe. Oh sorry. This key frames are going off and this is the new ones. And we have our final idle animation. Great. All right, so before I show you all of the final clips, a little trick is to take your EDL animation in which our cases this variation of the scale and add it to all of your animations so that your player is always performing the evil animation, even though they can be recovered in on any kind of boost. And you just get your specific animation, which in this case is the recovery based on our experiment early medieval attribute. And you add your scale, even animation, so it looks so much better. Alright, so I have already created all of our animation. Again, you can add and modify as much as you want, but I'm going to show you what I have done for our needle animation. We have our modification on the scale, on the recovery. We have modification on whether or not the sprite renderer is enabled again, and the evil animation inside it to every animation clip. For this should boost. I have changed the color of our sprite and a little thing, if you want to change any property of your sprite, render that. You need to also add. Sprite property otherwise is not going to work. And we have these little orient modification. And now for the speed, I have added both color and rotation. Color is pretty much the same as our should boost as ours should work, but with blue color. And a rotation is a rotation on the c-axis of 33 points and eight. Repeat this over and over again. Again. Feel free to make this animation as you want. Alright, so now that we have our animation clips, and the next thing we need to do is to control our state machine. And you just go 20 meter is you cannot find this windowed. You go to Window Animation and opening up. And this is your estate machine. And, and the very first thing I need to tell you that this is the state in which there is our default transit. And that will tell the game in which an emission should they gameObject status. In this case, and pretty much in every case is going to be the evil animation. And we have this other three animations. Great. So the first thing you should do before just that making transient is think of your high priority animation clip. This is the clip that you, game objects should go no matter what state is currently at. In this case, I want our players to go to a recovery state no matter what state they are currently at. So when we start making transit use, we need to make mandatory to go to recovery if we get hit. All right, so now to create transit Audience, First of all, you need to send some kind of conditionals and we are going to use booleans. So booleans is recovering. Another Boolean representing the suit boast, and another Boolean representing the speed boost. Great. Now that you have all of your booleans, you right-click on any state, make a transition and let's start with the recovery we want at Transitorium for the evil animation to their recovery. And one back to EDL. And now you need to do two things in every animation. I mean, transient, Sorry, you need to take the time and place these two guys all the way to the left. Alright, so the only thing left to do in this transit agencies actually set the constraints to go from one state to another. And since we have talk about that, our recovery is stated the highest priority. We should not place our speed was and should boost booleans because we want to watch your recovery. No matter what, only if our is recovery Boolean is true showed you can just and get rid of these two guys and now go to the other transition and say, our three booleans needs to meet the following condition. We want our recovery a state to be false, Our should lose to be false, and our speed was to be fall. This way we go to our evil animation. Great, so the only thing left to do is to do all of this for all of the transitions. Alright, so once you have all of Georgia CDOs, again, this is just a Boolean logic. If you find any problem, don't doubt on asking on the comments. And the only thing left to do is to code this whole process. So let's go to our players script. And we're gonna create a new variable which is u, into a public family, animator. And let's call it animator. Great. Now we need to do in these centers with our rigid body. So let's say animator equals two these and get component. And he made the great. Alright, so now we need to control our booleans. So I have created an update animation method and call it on our update method. And to control our body. And you just go animator. And he made toward that set bowl. And inside here in the first argument is the name of the Bolen, so is recovery. And on the second argument is the value of our volumes. So we already have a volume for these values, so is recovering. And for the other two booleans, we are going to use our time air bubbles inside I wear Boolean conditions show if our timer is less than or equal to our time limit means that we are inside the boasted effects. So we asked, placed that condition on our Boolean animation. All right, so the only thing left to do is to test this out. So let's go to our scene and let's create some power up so we can easily check if this is working. And let's place that should boost and under spit burst and let's click play. Our players show less Tarot now while idle animation, and now I got hit and the recovery animations Start. Now if I pick the spit boast disbursed property, start and I go from recovery to I mean to speed v2 recovery and then from recovery to speed boost. And if I pick up the should boost, this should lose animation stat. Great. All right, so I'm going to now create every other animation for our game objects and pretty much all of them are going to be evil. And then I'm going to show you the most important ones. Alright, so I have a re-created every animation and let's do a really quick tour over what I have done for our CLL animation. We have our color modification going from blue to purple and then back to blue. For our speed boost pickup, we had the same for our speed boost. We have some flipping for an hour should boost, we have again the coloring for our CLP cap we have. And the same as our, it'll play an animation on our UFO. We have fair rotation on our rocket. We have a modification on both axes of the scale. And for the shooter, I have changed in these sprites and these two newest sprites are handmade. I have done this based on the based a sprite and usual finding on the resource sex union, the skill share. Don't worry about that. And for the background, I have added both flipping and color to get these background animation. We have some color flipping and the stars are moving around. And for all of these animation, you don't have to do anything apart from creating them and adding them to your brief apps with the overwrite function because they will always be on that animation estate. No wonder what. All right, so before we go, let's do a little thing which is so cool and nice to make our cameras sake whenever we receive a heat. So let's go to our camera gameObject, and it's actually add nanometre. And let's create the animation. And this animation is going to be called seq. Let's go to our animation folder, scene, camera, shake and shake. And this animation is as simple as the paucity ion. And let's move it around on the axis. So let's move it around a little bit on the eggs, and then a little bit on the wine. Now, back to the y and back to the x. Now let's make these a lot shorter. And we have 3D animation. Great. Now on our machine is ten. This is a little bit different because I want to control this with a trigger so that when we get hit, the animation is triggered. And when the animation ends, I want the animation to go away. So first of all, you need to go to your animation clip for your camera. And it's this one on and take the loop time. Alright, so for the transitions, we need a univalent state, which is the camera and not morbid and all. So let created right now Camilla EDL and is going to be empty. And this is going to be the default. A state. Great. Now for the trendsetters, We need a trigger, which is going to be called camera shake. And now the transitions are a little bit different from camera to camera shake. We need to have no exit time, but we need to set the transition duration to 0. And we need to set the trigger. Now for the cameras sake back, we need to have an exit time of one and the transition duration to 0. And the last thing we need to do is go to our player hit method which say think is with yeah, here. And before we do anything else, let's find our camera object. So again, opposite that fine camera that you get component to get our animator component. And all you need to do is set, trigger, trigger, and insight here the name of the tree or just sorry, is not Camelot but main camera, my bath. Now back to unity. Let's see how this looks. And now whenever we receive a heat, we shall see our camera shaking. So let's see if I can manage to get hidden purpose as heat with this UFO. And as you can see, the effect act properly weight. So that will be all for this lesson. I hope you enjoyed making this animation. Personally, I love to animate, as you can see from the animation of the course. And I think that again, looks so much better right now. And on the next lesson we're gonna get right into both visual effects and music. So I hope you are excited and now we see you there. 15. Adding Particles To Our Game: Hello everyone and welcome to another lesson of the course. In this lesson, we are going to add particle store game in the process of adding particles. So you're game is pretty simple. You just need to follow two steps. The first step is to create a particle system which is no more than again object that you will then instantiate. When creating a particle system, you can customize every little aspect about it. But I recommend you to pay special attention to the render of the particles, which is how its particle looks, the emission, which is how are the particles distributed when being spawned. And the three core characteristics of each particle, the size, the speed, and the lifetime. When you had your particle system, all that is left is to create it in the current time and in the correct position. To do this, you can apply this transition process we used in the shooting lesson. Once you have identified your trigger, you just need to link it with a prefab you created in the first step. So when you went to add visual effects through her, game particles are really useful because they are so easy to do and give your game a really cool-looking. So the first thing we need to do is create a particle systems and just go to game up their defects particle system. Now let's rename it to a player projectile effect. We're gonna start with that. And now the first thing I want to do is change the login of its particles. So just go to Render and let's change it to a default sprite. Now to make it a circle it has go to texts are sheet animation. Take it and change the mode for Hungary to Sprite. And now you see the NOP sprite which is reuse really down here. Great. Now let's St DME Xian, because right now we have a cone, as you can see with this light blue line, and let's change it to a SFR. And now for the MSU, and I want to create that bars, which is going to be around 50 particles in one cycle or three cycles. And now we need to change their color, which is going to be the same as our players, doesn't matter too much. And we need to change the looping to uncheck. Let's change the duration to really quickly. And now let's say in the lifetime to one and this bit to eight. So we have heard they'll Barstow particles are great. Now, the only thing left to do is change the size of our lifetimes or wear particles start full size and get smaller over time. So yes, check the size of our lifetime books and no cake this curve which is representing the two key frames of the animation. And now we just inverted so that our particles will go from bigger to steal our great. Alright, so now that you have your particle effect, go to your prefab and do just store it as if. And new cell gameObject is. Alright, so now we need to get right into the ghosts or get rid of your particle system and go to your projectile is a script. And now we're going to create that public gameObject variable to store our effect. And now when we start the game, we want to instantiate that effects. So we go to GameObject and new effect. Let's use the instantiated. And this time we're going to use it with three arguments so that it not as the projectile positions or let's call it the first element is a preferred, the second is the citizen soldiers for procedure. And the third one is the angle. That identity. Wait now less and give it a name and apparent so that everything keeps organize. So the name is going to be projectile effect. And we just said the parents knew effect that transformed that said parent. We just find out where oh, sorry. Where. Gameobject that fine effects. That just form. Right? Alright, so the only thing left to do apart from, of course, linking our prefab with our effect is to make that effect smaller. So let's place it in front of the player, and right now is so much VR. So let's just make the escape slower. So let's start with 0.2. Maybe, I don't know. Fine-tune the C2 and the, I think it's much bigger. So from one, find one. Let's check it out the arrow. That's good. And now I want this bit to be faster, so let's make it ten and the psi one, the lifetime to be 0.7 maybe. Thus to the slope. Let's take it to 20. Yeah, let's see how this looks inside again. Now just remember to override your changes so you can see it on your prefab. And now let's click play and see if this looks good. Yeah, they are, they need to die sooner, but the speed is pretty, pretty good. All right, so I have adjusted a little bit some values of our particle system. I have tended to just one cycle and this pth lifestyle undulation I have also saying that again, you can fully customize your particles as much as you want. And now, let's unpack the prefab to create another one for our enemy. So we just have Baggett and now let us say it, enemy projectile effect and we projectile, if it great and knowledge set it to red. Red color, Great. Now we should see direct color. Now let's store it. We can get rid of this and now we just need to add it to our enemy projectile script. And now let's see if this is working. Let's see fast shooter spawns and should appreciate Talia is working perfectly. Alright, so we are going to stick with the basics when it comes to a particle system. And I'm going to create more effects to other students in the game black, like an immediate structure nor power up picking. And then I'm going to tell you and the important things that you need to do when creating them. Alright, so I have already created three effects for its enemy. And the only thing notable is that I have had it as a Concord. You just click on this little arrow on Jerusalem at random between two colors. And you can select two colors to get your particles on a color between these two values. And on the enemy script, I just added a method, wheat, and basically do the same as the instantiation before and call that method whenever an enemy has been destroyed. Alright, so now pretty much the same for our power After Effects. I have created three and experimental same between two colors and a little bit smaller, as you can see, is pretty much the same as does rest of the particles. Alright, so do end up with, I have created two, an explosion effects. One for our she'll, which is I live, is lower bars with different colors. And the other one is for when our player lose the game, which is this one. And this is a really big explosion with a lot of SB is our lifetime, which is going to look pretty good. So right now let's get into the code so you can see what I have done. And for the both CL downplayed explosion, I have created two different methods. This one is called on the UI method. I have commented this laser, we can test this out now. And the other one is called Through the player heat also. And I think it's yeah, right here. So now let's get right into the game and let's see how these look. And let's really Cecilia, Let's pick up Cl. And now if I were shelled, get destroyed, all of the particles appear and I think they may have to be a little bit faster, but that's no problem. We can change it and are now less get killed on purpose. As you can see, the game looks so much more better. We thought of these particles around and we're just on the basic. You can get this as far as you want. And as you can see, these particles look pretty good when we do our death animation in which our enemies are going to be high then and I'm, we're player also is going to look so much better. Don't worry about that. All right, so that will be all for this lesson. Again. Hence it they don't taking your chain on creating your particles. I have just stick with the same basic effect just for the sake of, of not being the lesson too long. But don't worry if you spend some time because as you can see, the game looks so much period if you add particles effects. So I hope you enjoyed this lesson and the next one we're gonna get right into adding music and sound effects to our game. I heard you're excited, and I will see you there. 16. Music & SFX Implementation: Hello everyone and welcome to another lesson of the course. In this lesson, we are going to get the right team to music and sound effects. Before we started in San effects than music tower game. Let's learn a little bit about the two main audio components in Unity when you went to and this kind of feature to your game, you'll probably use both audio sources and audio mix as an audio source is a component used to play audio clips. But you can also customize how you won those beliefs to be played. For example, modifying their volume and beat or making them play on loop mode. You're going to use one audio source to blame multiple audio clips. But keep it in mind that you need the game object that these playing their game to be alive and she likely be solver, otherwise, you won't hear anything. And under mixer is an element that lets you control your audio sources, outputs modified their volumes, mute them, and follow them. This is especially useful if you have different volumes within your audio clips because you can create different groups for each family of clips and then tweak each group volume to get to a balanced game audio. For example, you might have an audio mixer for your main playable the scene and you won your sensor effects to sound on top of your background music that you can output your players, enemies, and Power Apps. Audio source set is one to one group inside your mixers, and then your music to an isolated mixer group. Then you can control each volume so that your music doesn't overlap, your son effects, and so that your whole game doesn't have to be too loud in order then to hit everything perfectly. All right, we're gonna start with sound effects and the projectile's sound effect, because it's going to be the simplest held. Let's go to our audio folder and create another folder, which is going to be call mixers. Inside mixer folder, let's create the audio mixer for our level a scene. And now we need to greed I group for our projectile's sodas. Projectiles, great. And now we can go through our pre-fab folder, our player projectile and our NAEP reactor, necessarily making both at the same time nonetheless add an audio source which dealt with these two into 3D periodic table group within the level audio mixer. Great. Now we need to set a play on Awake. No. And we need to set the audio clip for both of these laser. So let's go to Bono's, And I think these two guys looks good. Let's go first with the player predictor and lets say laser effect to for our autoclave and now for the enemy projectile, let's set the laser one. Alright? Alright, I don't know why I tell you to not to take the planar wave box, but you had to actually take it so that it's play one time when the title gets instantiated. And now if I shudder should use, you'll hear the sound effect as if it suits. Yeah, that's good. And 40 players, Yeah, that's good too. The process is pretty much the same for the rest of the sound effects. But let's actually do re, now the sound effect that is been playing going up, power up pick as is being picked up. So we can not play that sound. So nowhere power up a squid because the power app is getting destroyed when the player collides with it. So we need to do it on our player game object. So legos, while you were player and all your source and the output is going to be a new group. And actually this pickup group I have created before, but with ONE, with a needed anymore. So yes, save player. So we're gonna control it later on and no two player and the output is going to be play a year. Now we set no nuclear because we are going to control the audio clip on our script and, and take the play on Awake box. Now inside our player scraped, let's create Daniel method down here, which is going to be public. So we can call it through other scripts, which is going to be public. Boys. Play, sound effect, which is when one argument of type autoclave, which is going to be glib. And now everything that this method is going to do is get the layer audio source component, audios, so ors component and play when shot of our clip. Right? Now inside our power up is great. We need to create an audio clip representing a clip of its power up. So you're going to be clip and actually let's name it sound effect. I like that better. And now when we collect with the pleasure, we want to send that signal to the game object layer. Let's copy this up. Based eighth graders. So the method we are going to call is play sound. Play, sound effect with our clip component, with our sound effect, sorry. Sound effect. Yeah. Alright, so I have this idea to o width, face it up six for our speed boost for this should lose power up seven ampere ACL, pick up, SVA axial up. And now if we play, we should hear each sound effects correctly. So if I pick up the sealed is correct, they should boost and the speed. Great. Now let's do the sound effects for when our plate is getting heated. One with Cl and one with no Cl. And let's start with the seal one. So let's go to our player. Actually, let's go to our player hit method. We seize on the UI and let's add an audio clip or the UI, which is going to be public sealed. Sound effect actually is going to be, of course, an audio clip and it's going to be sealed down. Some defect. Now when we destroyed our player CL, we aren't going to call the same method that we did before, but with these arguments. So it's inside escalate. We can get rid of this from the last lesson. It's here, yeah, GameObject that find. Let's actually go through all of this. And now we want to play a sound effect. Plays sound effect with our Cl down. Sound effect. Great. Now pretty much the same for the nose heel sound effects or let's create another public audio clip is going to be player heat sound, sound effect. And now we do the same that we did before, but inside our CLD note up if statements. So let's place all of these inside brackets. And now let's call the same method with another argument. So it's Layer Heat, Santa Effect. Great, Great. So I have this edit to with these two sound effects, 48 element. And now let's see how these sound as pick up VCO or know if I get hit. This yield sand looks good and now the heat. Yeah, that looks good too. All right, so we are almost done with sound effects. We just need to make a both player deaths and enemy that sound effects. So we're going to do both of them on our gain controller game objects. So let's add the audio source and let's create a new group which is going to be in control are great. And now we want our game controller output to be today mixer. Great. And now let's note said the other glib less control it on discrete and we don't want to play it on awake. Now inside our again controller script, let's create two variables of tape. Audio, clip, audio, which is going to be Player, death, explosion sound effect and publicly audio ugly, enemy explosion sound effect. Right? Now down here let's create two methods which are going to be one. Then went public. They privately run is going to be the enemy. So play enemy, explosion sound effect. And the other one is going to be probably because we're going to call it through the UI, scraped play layer explosion sound effect. And they will Tarragona and just lay one shot of the corresponding audio clip. So let's go to our place sound effect only play it escaped unless pick these up. And now we yes, faced it here and here we just change these for enemy, oh sorry, enemy explosion, sound effect. And here, player explosion centric. Now we need to call this method in our UAS grid when the game over a start. So let's call it here. So GameObject. That fine grained control. In controller, that gets component or solid that you get the component controller script. And now we call the play later explosion sound effect. Great. Price OBE faraway, there's this out. We need to comment these lines or we don't want to traverse the game over scene. And we need to call this method that I forgot to do. And we want to call this method on the enemy down method. Great. Alright, so back to unity. I have decided to place these two audio clips for both effects. And I have used a little bit the volume because these two clips are too loud. So let's see how all of the sound, and now let's kill an enemy and see the sound effects. Yeah, that, that's pretty good. And let's get hidden purpose so we can check the GameOver sound, which is going to be yeah, that looks, that sounds very good. All right, so now that we have all of our Sun effects and before we jump into the amuses, which is just one simple step, let's adjust all of these volumes. And for any of you that don't know too much about audio, you want your volumes to be between minus six and minus 12. That's the sweet spot for human Odyssean show. Let's click Play. And now we can mute and solo every output. So let's just soloing the ng-controller. And let's see the sound. So if I kill an enemy is 22 and inside get heat 22. So let's increase it a little bit. Now let's solo it. The player sounds, which is the getting heat and the big ups, the pickups are on minus 17, which is pretty good. And if I get here is a little bit too low grade. So again, this is going to be increased it up a little bit. And now for the projectile's, let's click play and swallow it. And it 4n minus 32 Lao, let's increase it. I don't know here. And now let's take it out. Yeah. Now it's on minus 11, I think. Yeah, I think this one is too loud. And now, even though you can hear it too loud or too high, it may be because of your Windows configuration. You want them both to, to be on the swift boat between 612 minus six and minus 12. Alright, so now the only thing left to do is the music, and the music is pretty simple. We are going to play the music through our level gameObject. So let's add a component and audio source. Let's first of all create the mixer, which is going to be music. And now we want our level gameObject to be output to music. And now let's check the loop and the play on awake. And now for the music anyone to go with intergalactic odyssey. And now let's click Play. It may be too loud. I think. Let's take it out with the audio mixer open and let's see how much the music sound. It's minus ten. Minus nine is pretty, is pretty good. Let's see when the music starts. Minus nine data, that's really pretty good. Alright, so before we jump into both main menu and GameOver music, let's actually do a little thing which is to decrease our music minus ten and increase our master volume so that our sound effects sounds lower than our music. And now let's click play and see the levels. And I think now it's so much better. Our game is around 12. Yeah, we can size good. It reaches minus seven in some points, so it's pretty Very good. All right, so the only thing left to do is to create junior audio mixer for both Menu and GameOver, which is going to have just one master group game over. And now we just need to go to our corresponding sins. And that sat to the background. For example, an audio source, which is going to be head to the menu audio mixer. And we just need to set the music which is u into, for me, intergalactic, I think now it's inelastic is the level one interplanetary. And now let's set the interplanetary. And now we can mess up with volume or with the audio mix satellites played to see how this looks. Let's go to our menu and it's around minus ten, minus nine, that's good. All right, so I have already done the same for the GameOver. Alright, so that would be all for this lesson. Our game looks so much better. We thought of this sound effects and Biswas, particles and animations. And thank you so much again for getting all the way up to this point of the course and so proud of you for getting here and I hope you are enduring in as much as I am doing making this game. And on the next lesson we are going to almost finish the game. We're gonna do valley bell entrance and exit in animation for our players. And then we just need to policy again, I'm built our final game. So again, thank you so much for watching and I will see you in the next lesson. 17. Entrance & Game Over Animation Development: Hello everyone and welcome to another lesson of the girls. In this lesson, we are going to create an entrance and an exit in animation. When you want to develop on eschewed game animation, you may find useful thinking about animation as a ladder Ingrid CT step is echoed keyframe. The first step for creating that mother will be to have an overall look of your whole animation, thinking about the start and end point and as much of the medulla steps as possible. Of the rather, you need to think about what should be happening on the screen and how you can develop that process into your code. Once you have every step of your ladder, GS need to link them in the correct order and monies that density on Tang to one another. In this case, we are developing both an entrance and an GameOver skipped animation. For the interests animation, we have our three-step Luder in which the game start. So when I read the text and then starting again while showing a goat text, the first step will be the fading animation in which we just need to hypertext is stop the game and said that the late for the fade into and the second step will be the text. This is as simple as showing that text and then waiting a little bit before hiding it. The third step will be the goat text. In this final step, we need to show they go desk while he started a game, then going to in a little bit before heading Diego text. And for the GameOver animation, we find also a three-year step ladder for our animation that starts with the player explosion effects continue with a GameOver text and ends with the transit you into the game over scene. The first step will be to play the player explosion effect and waiting for it to end. In this step, we need to manage both visual and audio effects, and we also need to stop the game. The second step will be to show the game over text, and then a little bit before starting the third step. And the final step will be to trigger the fade-out animation and waiting for it to end before transitioning to the next lesson. So these two new animations and a little bit different from the ones we created on the animation lesson, because we are going to make them through code. And the very first thing we are going to do is a fade out and fade Dean animation for when we are changing as scenes. And to do that, we need to first create an image which is going to be just a black background, which will cover our whole screens. Or let's place it all over the screen. And now we need to do three animations. Fade in and fade out and either animation, so that's a EDL trend. Sit down and let's store it. Unless trolley renamed the CME to Transitorium trend CT. And now we need to add the property of color because color, as you may know, is RDB a. And the letter will be sent the alphabet center, which is how much transparency and emit pass. So now all we need to do is set the transparency all the way down to 0, so that is fully transparent and now get rid of all of these keyframes. Now we have our EDL animation, which is just one key free, Great. We need two new clips which are going to be fade out and fading. Let us start with fade out. And we need the image, the color property again. And now we need a starting from transparent all the way up to fully and black. And for the fading transition is the same but inverted. So we start all the way black and we go from black to transparent. So we just get rid of this keyframe and we create a new one here, which is alpha 0. Now we have our three animations right? Now on our state machine, we want to start not on our either trend citizen, but on our fade in transit. They don't judge when we start the game. And now we want to go from failing to EDL automatically. So we need to set an exit time which is going to be, I don't know, 1, fine, maybe I don't know, we can change that later on. And the transition relation is going to be 0. Now we want a trigger which is going to be phased out. And we make a transition from either to fade out and let's make it Manuel. And we are going to control that trend shitty and with our fade-out triggered, great. Yeah, yes. Notices that have made a mistake just said your exit time to one. Sorry about that. And now, if you click play, you shall see that your game is start with a really cool fading and stays on the EDL animation. Now, all we need to do is set. First of all, let's set our trend city on image to false so we can see through it on the spectrum. And we are going to set the emit enabled, judge, when we start the game so we can work more portable. Now let's get right into the code. And now for example, let's update the image in our UI scripts or we just go GameObject that find. And let's fight our friend city-owned GameObject. We get the image component and we just enable it. That enable equals true. Great. Alright, so now for the fade out, we need to do two things. First of all, we need to call the trigger on the animator, and then we need to wait for that animation to end before we changed the scene. So what we're going to do is to create a new numerator, which is going to be public eye enumerator process after game over, which is going to accept one argument which is going to D delay. So we can easily manage that value. And now we need to first of all call our trigger. And we need to find our transit on game objects. So we need to get the component which is your intermediate anime tour. And we need to set a trigger. And I think it was called fade-out. Probably. Fade, sorry, fade out. And then we need to wait. So yield, return, new, wait four seconds. And the late argument. And then we change our scene. So let's get rid of this. And of course here and paste it over there. Now we need to call the coroutines. So let's start coroutine process after GameOver. And we are going to set the delay to 1.5, for example. Now as we have done before, let's place a little thing here to make our life easier. So if input that get key down, keycode q, for example, we call our GameOver methods so we can easily get into Destin. Great. So before with these outlets make both transitions is lower because I have set to 1.5 and I need these to be 1.5. So we just take these keyframes and get them all the way to arrive until 1.5 seconds. Wait. Now you've played, you sort of see that you are start with fading. And now if I click the Q t, we get into the fade out and the game over scene stats. Great. Alright, before we move on, let's tweak a little bit these two animations, and I want these start by waiting a little bit black and then continuing with the animation, but a little bit is lower, so all the way up to 1.222 seconds, that's pretty good. And for the fade out, I went to pretty much the same. I want these to end on the second two, but I want it to be black for yeah, like that for example. Let's see how this looks. Now does looks much better and knife-like. Let q go to, Yeah, that's a really good. Alright, so now we need to do the same for both Menu and GameOver. So we yes, take our transit on GameObject, we copy it. And we will, for example, to our menu. We based it on our Canvas and we need to change the code. All right, so the very first thing we need to do is to get these code that enables the trend city-owned onto the static method. And now when we press a button, we need that co-routine to a start that wait for the fading to start, I mean to end, sorry. So we just do the same. Surely we can't even copy it from here. And it was down here. So process after GameOver, we can just copy and paste here and say process after Play Button Pressed. Process after Labor, don't press. Now get this uppercase. And now we just need to change the scene loaded, which is going to be level. Right now we need to call the coroutine here. So start coroutine and now we call the process after play with on purpose and we are going to wait 1.5. Now pretty much the same for the exit Pudong. We just copy and paste and instead of loading scene, we just quit the game. And Change the name to play with Don, pressed to exit button pressed. And we just get the co-routine called here with exit button pressed. Alright, so here and on the GameOver itself, there'll be trickier because if you leave your code like this, you will see that you are not able to burn as anybody else because the emitter is above and they both Dom sign right now, pressing it and nothing is happening. We can fix that easily just by creating a new coroutine which is going to be 58. I enumerator. Wait for fade in and we just return new. I mean guilt. Return new, wait four seconds. And we wait two seconds. And then we disabled the coroutines. So we do this naval equals false, and now we need to call it on the start method. This way the images disabled when we went to press a bottom. Wait for fading. And now before we start any animation we need to start, I mean, enabled the image property. So enabled, great. And now you click Play, you'll see that everything is fine. You're starting with a faint Dean and you can produce your book. Dhamma fade-out appears and then change this scene to get our final trend citizen. So I'm going to do now is do the same for our GameOver. Alright, so once you have all of your fade in and fade out Santa Monica and Dan, let's make the actual animation. And the first thing we need to do is to create two texts this inside our canvas. So let's create that tax which is going to be ready. And let's set the font, the color, and the style. And let's set the scaling box. And we want it to be in the center. We want it to be a really big text. Thus, That's the week. Yeah, that looks good. And now let's call it two. Ready? And now let's duplicate it. And this place, another one which is going to be go. Now let's move it around and rename it. Now before we jump into coding the animation, I want to control which are allowed when the game is started or not. So we need to create a boolean on three different scripts, which is going to be the same game on which you're going to be false at the start. And now let's created on digging controller, the UI unknown D player. So here on the player, a script down here. Now, I don't want our players to able to. If the game has another start. So if in-game ONE, then we take the input and arrestees. We check the input and the shooting. Now, just take the input. Now for the UI, I don't want our Tang to start until the game hasn't started. So update time is only able to start if the game is shown. And the rest is totally fine. And we're going to actually get rid of this code. I'm for digging controller. I only want our entities spawning if the game has started. All right, so now let's get right into the business. And the first thing we need to do is to create two new variables which are going to be of type, text, ready and public text. Go. Great. Now we are going to create several coroutines and methods are lower. All of them are going to start with this method which is going to be called start again. And this method is going to be called on the start. So start again. Now the first step is to disable both text sticks. So we just need to do ready that get component. Text enabled equals to false. And the same for the Go text with the enabled property. Now we want to wait for the fade into end. So we just copy all of this from our manuscript and we based it here. And we call this coroutine from our method. So let's start coroutine and wait for fading. Great. Now the next thing should be to show our ready text for a little bit of time. So we need to create an NeoChord routine which is going to be I enumerate or ready routing. And now let's created with again load delay argument. And inside these coroutine, we want to show the ready text. Then we want to wait for the delay introduced. And then we want to hide again the text. So enable equals false. And we want to start this coroutine after we have the sable. I mean, after the famed Dean has been conclude. So we just call it here and readied routine with a delay of two seconds for the sample. After that, we went to. Showed our ego texts, so pretty much the same. Lets actually copy all of this. And we just need to change little things like this one. And this ready is going to be both go. And the delay is going to be 1.5. For example, we call the coroutine here and instead of ready is go query routine for 1.5. And the final step, once we have shown the Go routine, we just want to start again, so we need to change our variable from the three escaped. So gay mom equals we want to find out where pleasure, so find pleasure. Pleasure that get Component. Layer two with the player escape game on, which is private. Sorry about that. And it's going to be true. And now the same for the gain controller, which is also private. Sorry, I forgot to tell you to make them public. So again, controller and in control like grade, and now we're going to gain controller and chains these Boolean to public. So public, and we get this on the player screen. This goes down rate. Now instead, inside the unity, all we need to do is set our game objects here so we're ready. Text is this one and the ego text is this one. All right, so now if we click play, we shall see the game is starting once the fading animation is out there ready test sulla appear for a little time, then Diigo text appear and we can move only when they go. Text is up. So we'll start and let's see the faint dean now directly text and now they go next. Great, great. So now we need to do a similar process for the GameOver animation. So let's duplicate this text and let's place Game Over. Let's move it around a little bit to the middle of the screen, maybe around here, game over. Let's place the space. And now we want to rename it to game over, let's actually disable it. And now we just need to get right into the code. Now for the code of the script, we need to create a new variable of type text, which is going to be for the game over text. So game over text. All right, so for the GameOver, we need to do three things. One of them we have array thinking ghetto, which is passing this data to our static game object ideas extracted the method. And first of all, we need to post the music. And I think that music will assume d level game object. Let's take it out. And it's on the level background is on the level down the level. Great. So we just go to GameObject that fine level that get component for the source. And we stop. Great. Alright, so now we need to destroy all of the entities. So we are going to create two methods. One is going to be call destroy entities, which is going to call another new method, which is going to be and destroy entities with Duck. Let's call it with an argument of type string, which is going to be the back. Now we need to create a gameObject vector, which is going to be entities and is going to be called with the game object, that fine game objects with, with the argument tack, Great. Now we need that foreach loop, which is going to have for each game object called geo entities vector. We just destroyed the old object. And now we just need to call this new method four times for all of our tax and the ones that are not created, jet will be created right now, don't worry. So we just need to create the new tax. So this duck is going to be NME. Then the power apps were up. This is Sally, they'll be messy. So and as you get rid of this and wear a tie and NMI. Nmi, object dialects as trolley, name it player projectiles. Now everyone is string, Great. Now we will create those stacked later on. And we just need to call the method on the destroyed, I mean, the GameOver method, great. Now, after all of this is done, we just want to show the DO text. So we just get these method, for example, we can use it as a template. And we create the method which is going to be and game over routine, game over text routine. We just get the instead of readies game over text. And now instead of calling this routine, we call the other one. So after the game mobile techs routine is done, we call the final game over routine. And instead of calling Thursday process after GameOver routine, we call the GameOver text everything. Great. So now back to unity. Let's create all of the tax data have not created jet. So the player is already the player. The player character needed a new tag, which is going to be called player projectile safe. I'm, we need also the enemy projectile. Back. Great. Now the player projectile is applied. The political dynamic is an enemy projectile. And the power apps need also attack, which is going to be our up. Now, select the three of them and yeah. All right, so now inside unity, we just need to go to our UI method and gameObject and select the corresponding text. And one thing I forgot to do is to destroy the player, the player game object. So if layers life equals 0, we can actually that's not destroyed but just hide it. So GameObject that fine. Player get component. Let's get the sprite render air. So sprite render here, great. Enabled equals Great. And that's actually also a stop the animator because if not, it's going to activate the anemia chore, right? Alright, so the last thing we need to do that I forgot to tell you is to wait a little bit before we show the GameOver text. So we just, again, do you really turn your first second delay? And let's actually wait just 1 second, for example. Now, let's test this out. The whole transitions and we start with the introns animation. That works perfectly. And now if I play and get killed on purpose, see how the and GameOver animation looks like. We get kale, that text now that x go away and the fading goes. Great. All right, so that will be all for this lesson. This was the last proper lesson of the course. On the next lesson, we are going to again polish the game, but I think there is not that much to police, don't worry. You will know in the next lesson. And then we just need to build again so that everybody can come play your game. So I hope you had fun making this game. They enjoyed so much Deaton do to do so. And thank you so much for watching again. And I will see you in the next lesson. 18. Polish Second Stage: Hello everyone and welcome to and that, that lesson of the course. Today we are working on the second and final state of our games policy process. We are almost done with our gain. But before we build it so that everybody can play it, we need to again, spend some time making EB habit that expedience. That is not that much the police because we have taken care of doing the things as best as we could. But let's quickly review everything that I have changed since the last lesson. That by taking a look at toolbox, one of them was preventing the player to work from the shoot boost animation state. Today they'll animation estate because of a mistake on the Booleans controlling that transit. Then the other one, which goes into fade-out animation on the GameOver animation to be invisible because of a image component being disabled. I just added a line of code which enables the image before joining the animation. Next, I change some values that don't affect directly the game by the delay time on short-term CDOs, the name of some instantiations are some methods and variables names. Finally, I refactor the code, change some variables or methods to private and fully commented all of the scripts. You're going to skip this step if you are not comfortable on modifying your code structure. But I highly recommend that you give it a try because the quality of your code reflects your skills as a programmer. I have done this and that you'll have an easier time understanding Nicole, if you don't know the infant, the resources page. Now, we can surely say that I were a game is completely finished. All that is left to do is to build it so that other people complete. But we are going to take care of that on the next lesson. Thank you so much for watching and I will see you there. 19. Building Our Final Game: Hello everyone and welcome to another lesson of the course. In this lesson, we are going to finally build our final game. Building is the process of compiling your gaming to a set of archives that you can set to other people so that they can play it. When building your game, you will need to treat both the bill settings and the player settings. On a billion settings, you need to monitor the scenes, select which ones you want your game to consider date for the final product and in which order should they appear. You'll also need to select your target platform can be PC, console. And of course, all of the subcategories inside those three player settings, you can sell it both a company and a product name for your game. This last one will be the name of the executable file. And you can also change the icon of the final game. You can also modify the settings regarding the resolution and presentation incase you went to rescale it your game, or give the player different opinions about where solution and quality. And finally, you may want to customize those plasmids settings which controlled the animation, play it when the game is launching. Once you are happy with this to setting sets, you can just build your game and you will get all of the fights that your game needs to run. Then you can send them to whoever you want so that everybody can play your game. Alright, so there will be the last appropriately zone of their coach because we are going to sport our game from the Unity game engine to just a file that you can, I don't know, send to your friends or whatever you want. And the first attempt to do that is to, to File Build Settings. And we need to check some things here. First of all, make sure that all of your scenes are inside your Build Settings and that they are in the correct order so that your game, no sweetest scenes are on top of one another. And now our game is meant to be played on abbc. So just said PC, Mac, and Linux standalone plug-in for me is going to be windows and the architecture is going to be D6. Now you can leave pretty much everything here as the fault, and you just go to your player settings in which you can at just several things. So first of all, let's see like the company name, which is going to be for me just my name and a burden name is going to be especially last diversion is going to be 1. And now we cancel out the default cursor, which is going to be the default cursor of Windows or Mac. And the icon is going to be the player. So deeply year. We see right here, oh, it's to stretch out. Let's take this shoe their enemy. You can select which sever icon you want. But I'm going to with the sky. Yeah, that looks so much better. All right. Now you can mess up as much as you want with this optimum front. We are going to focus right now on this blessed image, which is the opsin related with their animation that these played whenever someone opens your game. So first of all, if you click preview and you get these windows out of the way, you will see that your game plays the animation that is going to be played. Finally, but don't worry too much. We will see the preview later on. For now on. Let's select the logo and we are going to add up logo that I have added, which is intro, I think. Yeah. Again, you can fully customize everything here. And I'm going to go with secondly also that they Unity logo appears first and that my custom lower for three seconds right now is you get these windows out of the way and click preview. You will see that the unity law gets placed and then my logo and then the game start. Notice that on the level of sin button, the menu sin, don't worry about that. All right, so once you are happy with your glass emit settings, you just click on Build and is going to open up your Unity folder. Let's create another folder which is going to be built. And in Siberia, this for the sake of organization, that's great. Windows that 86, great. Now you just see let your folder and click Select Folder. And now once the processes don't, you already have your again, your x for you again, which you can click on jazz plate. And this is all the fires out again, need to be running. Now if you want your friends to play your game, compress them all, and just send them via Google Drive or email or no, that's up to you. So I am going to space windows x 86 and click upset. And he will generate everything you just need to pass this archive to your friends. All right, so before we wrap up this lesson, let's give it that tried to our final game to see how this end up looking. And as you can see, everything looks pretty good and sounds pretty good to, and let's click play. We will then see that the exit Udemy is working, don't worry. And we have D_trans animation. And let's see how many points can I get? Is purely another volt, the difference between the first lesson and the last one, right? You have come all the way to this point to have enough final game. And there it is, the game over transit yarn and we have our recur. Now if I click Main menu, I can return to the menu. And now if I click exit, you will see the game is exiting with no problem. So that's it. That's the final lesson of the course. We have already our final game. And as I have told you, you can just send this file to your friends so that everyone can play it. Again. Thank you so much for getting all the way here. I'm quoting all of the course in means the world to me. And on the next lesson we are going to do a really quick wrap-up of the whole course. I hope you had fun making this game. I enjoyed so much teaching you how to do so. And again, thank you so much, I really appreciate it and I will see you in the next one. 20. Course Wrap Up: And I certainly globally the building way to the end of the goals. We have converted all of the basic about making games for reactivity. And hopefully you have learned a lot of mental processes that lead to your future employer yet. So to finish this course with, I want to give you as much as fit as their identity as possible to tell you not to stop here. These were just the beginning of your game development plenary bath. There are tons of new things to learn, interesting people to meet, and amazing experiences to half awaiting you out there. And before I go, I wanted to tell you that the ginger discourse is when, when they want to meet you, share it with your friends and leave are real, they're discussing. And below. I should remember if you need any help or if you just want to talk with me, you can find me on Twitter and LinkedIn as the neural level, or you can just take out my personal website. But Daniel syrup, whether that's got to take a closer look at our course myself and they work. Thank you so much for watching this course. I hoped you enjoyed it and that you've got a lot of the fifth. See you soon.