Building Unity Game From Scratch: Brick Breaker | Magic Coding | Skillshare

Building Unity Game From Scratch: Brick Breaker

Magic Coding, Game Developer Sensei

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
16 Lessons (4h 1m)
    • 1. Importing Assets

      14:53
    • 2. Paddle Movement

      22:02
    • 3. Ball

      26:46
    • 4. Brick

      18:07
    • 5. Brick2 And New Level

      8:06
    • 6. MainMenu

      12:27
    • 7. Gameplay UI

      13:03
    • 8. GameController

      19:04
    • 9. Gameplay Controller

      8:58
    • 10. Setting Up Score And Highscore

      15:50
    • 11. Life Counter

      15:16
    • 12. Chaning Levels

      17:04
    • 13. Setting Up Power-Ups

      8:53
    • 14. Finishing Power-Ups

      14:53
    • 15. Laser Power-Up

      19:56
    • 16. Adding Sound Effects

      5:47

About This Class

As most of you know Unity Game Engine is one of the most popular game engines used in game development.

It doesn't matter if your a beginner or an advanced game developer information in this course will help you a lot throughout your career as a game developer. Developing awesome, stunning, commercial quality games on a variety of platforms in the latest version of Unity 2018, plus with this knowledge and logic, you will be able to make games on your own, which is pretty amazing right?

The point of this is to take to the level creating your games on your own from scratch, so from Game to Game, you will get better at approaching to making your awesome games.

 

Transcripts

1. Importing Assets: What's up? Guys are here. And today we are going to create our brick breaker project and implement assets for our big breaker. So what are we waiting for? Let's do that right now. So the first thing when you open the unity you will go to the new. So I think you're already familiar with that. But I'm gonna repeated for the sake of those who are not. So it probably would have you probably. You will have no projects. So this will be empty or it will be at the learned tab. Where am I right now? Then, to open up a project you will go to open if you don't like the complaint One. But if you want to create a new project, click on you like there. And then we will change project Name to be, Let's say breath Bre breaker to the white did by You are at the studio will basically to tell myself this is a duty game and problem because I have. When I create the brick breaker, I already have that name on the project. So I'm adding this duty so that would be two d. We will not bother with these because these are not something that we work for it. So we'll just look for to the or treaty this case, our template will be key. Therefore, the location I keep my projects at C. U T projects. You can change that to your so I keep all my projects in your projects to change that freak on days three, three darts, you'll be impromptu where you want to put it. So let that folder and here we go less last but not least, enable Unity analytics. I mean, I did not have. I have no organization. I suppose you do not have to. Even though if you had one, it's still not needed to put it off. And that quick click on Create Project Moving on immunity Are you, Nicky Engine automatically great The scene's folder for us and created the sample scene. We're just gonna name gameplay instead of sample seen. So there is no need to create a separate folder and create the same for our gameplay. But it will do that later on when we want to add main menu. See, But let's not bother with that, and I'm gonna breathe. Explain the unity system what are really changing. What? What is what I mean, You could skip this true, because I have already explained once. But the key to success is repetition, so you'll understand it better when I explained more times and still have an option to skip that through it. You would like. Now, as I was saying, We will implement the What's the call? Protect the Sprite so good Fuller and I will go to desktop assets, assets, opportunity, games, break Blaker and I'll add these to unity. So, like this, we will wait for them to be implemented. So depending on sprites, this is how much you wait and that you have are Sprite. In here we have our art ball buttons, but we are gonna add our background. So we bury something you add that is our background and later on you'll add our borders. But now, as you can see, the first thing are antic. I am great to explain. Is our resolution as extreme? Right now, our background kinda is in the middle, but everything else is blue and that is our back home. We just actually this one army camera and that is because below to see this game that below it. We have this free aspect. When you click on it, you can change the resolution for big game. Now, when we change, our retains are build some things. A good file will build some things we want change. That's a platform for Android as a switch platform. So this But look it, look it and do it as the K. Never mind that I'm gonna show you real quick what what I am going to do with these resolutions. But as a team, we will wait or unity. Now that he has up spit out our platform and go to aspect, you can see we have a lot of these change on. You can see we have a lot of different resolutions, but my point is how to sharing the resolutions. But you say that we can add more resolutions by clicking on this plus button. But first I'm going. I'm going to go back to B. C. Max and Lennox. So sweet that and again, we will wait. I'm hoping it won't be long as it first went Android. So I skip that part. Come on. And yeah, as you can see, it's a lost faster for PC. So when you go to free aspect, then go on the plus sign you get add resolution. So right now resolution that we are looking for is 4400 and 80 by 800 now in label you can name it here and put any name you want, But if you want, you can see you right now Here I have no name for these resolutions because they are spit speaking for themselves, Rick. Right before, if you could see with expert ratio, it was like or trade mood by portrayed and it was $9. 16 of 16 at nine. Not so sure, and you can do that. And once you're done putting the aspect ratio or fixed resolution, just click on OK and you will save up your resolution when you're done with that. Just click on here Now in this game are not going to work with animations. I think not so sure, But if you want to add those, you go to window. We know. But where was it yet? No window your window. You search for animation and it's you right now it is floating, and everything here can be ruled, so everything here can be floating. Put it somewhere where you want to know where you feel comfortable so you can change with every wherever you want. And once you're done with your layout, you can go on here and save your layout. Likely out one or my layout of layout to the layoff for three D and so one by people we have a lot of different. You are services to buy. Three. This is four split. This is the fault one. But I'm not using people. I usually layout when we have tall, and we have wide. Depending on what you feel comfortable with, you will use it. The one that feeling most comfortable is the layout that I created. And it's the same layout as the fault one. Just delete the assets store, close the tab, and that is that so you can change this a little bit to be squeezed in, and that is that. So this is the layout that I'm using most of my time. So change just looked him back through it like this, so I won't see like the bigger picture of it. But it's not working yet. Something like this now for the folders There are big to me and I do not like when for us are like this big. So you will have this leather or here to change it up. They want to be big, small and so on. I'm gonna put it to be as small as possible, so I'm gonna scale it down, and that will be it for it. I'm just clear out, my consul, now that we have at our back from everything seems perfectly. But right now I'm gonna add Borders around because that is the only thing that we are missing for our background. Now it's our background. Adhere in empty game objects arrested on our backgrounds. Crawled out to create an empty game. Object. Here you call this board, there's this and inside our border rules have and a bitch, so you'll create an empty game object. Call this talk to talk at components and component will be sprite rendering and we'll add our box collider to D once you're done with that are sprite. Render will sit for the yellow like this yellow line. So click on here, circle button and then go on the yellow and you'll find the yells practice. As for the position, it will save 4.1 That will be it for the wide and excellent. Actually be zero and 4.1 will be for that top Scheer will be 3.7 since five. And why will be sweet Point way 0.86 now One thing that you can know this that is we cannot see our top or are yellow. And why is that? Well, this is for the sorting layer. If I've put our yellow to be a sorting layer one, it will be visible. If I put to be zero, it will be not so We are going to create here sorting layer So like here on sorting layer adds salting where and you'll have our backgrounds BG our lines or not, lions will be inside a background So tech are back Trump and our top with the background and for our top with Viv one So it is not inside, but it is on top our background and moving on. What's this? I'm in the room, boss still either added one more time because it did not, uh, he did not load the sprite and it was not fit in perfectly right now it it is. But when we move it so if the edit click on the Edit Collider and you will see these squares where they will put in, down, up and so on. So put it to be right, as with our top, and then click on again this radical idea when you're done, anything that will be for our top. Let's not add left and the right to do that We can go sprites our search for the yellow arts, our buttons yellow. Where is it? I think it's indeed now. Textures? Yeah. Here, Yellow added to our backgrounds. Name it left position it to be negative. Que 0.89. Where is the folk? That from one viewpoint at minus 2.98 y 0.12 and skill for the X will be 5.9 scale for the wild Be 3.1 and the rotation will be 90. So you think this will be our left and then we'll add box collided to D to it, which we'll we fixed to be sized in as the sprite is sized. I mean, is it should supposed to be like this. Now, the easiest way to do it when you're done with one duplicate that name it right put it to be on positive sides but at a bit more rights to the rights of 0.91 and basically that will be it. So sit for 90 91 23 not 2.91 matches Perfectly So, guys, that will be it for implementing our sprites and addict our background image. Do it. So you're not looking at the this blue color teams. So we have edited back from so guys that's will be in what I want to explain in the unities interface. I mean, I have really talked about it, but I thought when I talked a bit more about it or once more two more times three more times. Then you're just going to get it more into your head. You will repeat the same process. It will stick in your mind forever. And then when you open up your unity, you will know like blind bloodlessly you can go insert for the file projects will know everything. Where is it? Where is that time? As I said, guys, that will be it for this video. I see you in the next one, so I hope you'll like it. Goodbye and see you in the next video. 2. Paddle Movement: Hi, guys. I'm are here. And today we are going to at our paddle, and we're gonna implement our panel movement to it. So let's get right into it. Because I know you're Eagle too eager to learn some new stuff. So go to sprites goto art, and add this ball bridge. Then we're gonna rename our salvaged our paddle goed sortie layer and add sorting layer. Name that player to player layer, layer, layer like this and click on Enter. But I have already created one player layer so the other one is not needed. And then click on the sorting layer and add layer layer to the paddle. Now, as you can see, our panel is kind of do big. So we're going to scale it down on the axe and Roy by 0.4 and then went for for the Why wouldn't say somewhere, right? Minus 4.1. Best work somewhere around there will be our pal. And in our path, we're gonna add box collider. So box Collider te's needed. But we will check if everything is all right at it. Yep. Everything fits and we are going to add Are rigid body too deep What is Boss Collider? What is rigid body? Basically, box glider is used to detect collision between let's say, this paddle and our background rigid body is there to implement physics. If our boss glider was a trigger and we want to add power ups to it, we will have to put our power up to be a trigger. But a trigger will not work if we did not have rigid body D. Now, when I'm talking about rigid body, you can see we have body type. It can be dynamic cinematic. Instead we put to be dynamic and we start our dean. You can see our player will start falling because it has mass gravity scale senior drag, Anglo drag and so on. If I were to put my paddle to be cinematic, which it needs to be and I start the game up, you'll see nothing will happen. Our bread will be just will just stay in one place. And that is what we are going to use our rich body for in our box collided. So as us had, Boss Collider is there to detect collision and rigid body is there to implement physics inside of our paddle or inside game object. You put that in moving on Good Assets folder. Right Click on it, Right, Flake Girl up to Great Tab and create a folder. This bowler will be called scripts and then we're gonna open up our scripts Fuller at another bullet to it, which will call paddle Battle scripts, The script like this and that inside of our paddle scripts we're going to create and in and see shop scripts. Right? Click on it, Go to prayed, quit issue sharp script and we are going to call this paddle now. As you can see, I have created a folder for everything. So we have pulled for us. Our deal we have our fuller for the farms have are folding for the scene script sprites. Whenever I'm making something new, I'm trying to be as organized as I could be because believe me or not, it helps out to work in a project you have, how it helps out working organization. Because when you're organized and let's say I open up one of your projects, I can see where our despite burger scripts are harnesses. The scripts folder. Okay, we have a paddle scripts and then I can easily search up drop toe to paddle scripts. Now here we can add scripts for bombs, for movement, for separate things. Or you can create one big script and put everything in there. My subjection is to create more scripts, but not for every every every everything. But for the most of things that are not the same that are not the same time Should I see? Because that's a we create now. Movement, movement and bouts should be and could be placed as one. But let's say we're creating a tweedy RPG will have one for, let's say, script for movement, one for the attack, one for the defense or something like that. You understand my point. And as I was saying for the folders, I'm trying to keep the as organized as they could be. And I just like it this way because, as I said, I can find my way through the project. I could see what because let's say I'm not not work on these projects for, let's say, one month to 13 year, you have to Do you understand my point? I So the point. Waas. Let's say we did not work for these projects for a while, and we come backed it and you want to sit something you won't find. And it's a complete mess. So that is the thing that we do not want to be, as with our projects, or let's say you're working at the company, you send someone for your projects. And then he said, What what's this? Where's this With that and then you will have a problems to be accepted may be in the company that you want to work in or if you want some help, like for me and so on. I'm going to stop talking about this because I have talked enough now in our paddle, we're gonna add one more component, and that is our paddles script. Want yet added that open it up by double click on it, so I don't think on it, and you fill it up. You will open that up in visual studio or in money developed, depending on what you prefer, the more now inside our script, the first thing I always do it. Lead the comments, lead update, comment and delete the start. Come. But for this video, I believe that up because I'm gonna explain what it started with this update. But for that I'm gonna add some public public, low speed and the rights. Now our start function is not needed. But if you want to declare speed by not going into the unity so right now, when we put our variable to be public, it could It could be a visible inside our unity inspectors. When you click on our village, paddle it right now, click on it Good inspector, and you'll see inside or screams speed. Here we can change our speed to be Let's is ending 0.6 But that's one way to do it. But if our speed was private so we could add our speed to be inside our start function and then you get put 0.6 and this must be added with me. Add the float because we will have problems when we did not put it like we do not put F as declaration so we can know this is afloat afloat. I mean, right now really is as that as the comment says used this sport in in a second me a second a moment, please. That's what I want to say is this for honest instill ization and by saying that meaning that really is this to add Let's say some position like here right now, it will add the speed what we want to that's one way to do it in another way is just at here equals two, then 0.6 But I'm gonna leave this public. Let's say you're not satisfied with the speed, which is 0.6 You'll have to go back to the script and that changed here. But if you have it in public, you could just change it right here. And it will work right away, which is really good for debugging. So zero point there was sakes. Let's leave it at that. Now we're update function and our update function is called once per frame. And we have 60 frames in the second, meaning that our update function is called 60 times in the second. Right now, here, we're gonna add move ment curly brackets and then Sam my call. But right after that, we will have our void, movement, function, curlett, bronzes and then curly brackets. So we do not have these but anymore. Now, when they put this our movement function in our update function, we are calling our movement every who everyone's per frame as the common says. But we have 60 frames per second, meaning that this function will be called 60 times in a second. Now, as for our movement, we're gonna add float age which will equal Stoute inputs input that get access, get X rock and you're gonna leave our extra B includes horizontal. So what is this? Well, basically, I'm gonna put in here, right? The low print h remember age. And then I'm gonna explain What is that inside our unity. So right now, when I start up our game, you'll see something show up in council and that will be zero. I mean, value zero. You'll see that kid 000000 And it's moving fast right now. When I hold out a left arrow key, it is going to say minus one when I Ford holdout, right Arrow key is going to say one same goes for when I pressed a button or the but so as you can see this input that get extra horizontal gets me returns, the value, which we are typing. So when they want to go to the right side, meaning it's a positive side when I hold on right arrow key Will's make our panel go right in a positive way. Well, when we want to move on the left side, which is a negative Wait, we will hold on, Lefty and move on the left Left week. So is extreme, right? Happened to collapse when you hold down, right, we are going to the positive side when you're going to the left. We're going to the negative side and you concert that in, I think a component window. Don't edit preferences? No. So it's edit project settings and influence here. We have access and you'll have horizontal, as you can see when you hold on left will go to the left. But we go to write will go to, right? I mean, you can change these buttons to, let's say, a D age gay. You have hot a lot of choices, but I'm gonna leave this as it is. So right now you can see that when we move left or right, it's being recognized by horizontal. I mean by input X, which is actually our float H. Now we put our actors to be just access, not raw. It will go from 0 to 1 or zero to minus one in, uh, some posits. Now I'm gonna show you one more example. So you can choose what? Which way you want it more. So let this may be smoother for you. So you get to you right now, Labs, when I'm worrying, Okay. I did not say the scripts or save it first. So right now we are going to see some changes, but we declare the consul and then stop. Start out over again when our input is not, uh, thanks. Oh, I forgot. I mean, clean age not had lead that, but okay. Some things you'll never know what we hit. Downplay. You will see we have zero. Now when I fall down to write a rookie, Well, the right arrow key will go to one in seconds. So you will see physics right now, we'll go do one like these. So it's going from zero point. So 00 point Q 0.3457 point succeed. And then we're going like that one, and we're going from 1 to 0 like that back. So as you could see, where cute zero is your point 50.15 So my expectation, expectation. But my that's results. I'm gonna say my prediction is going 0.5 every frame. So that is how we are going when they put things to be, get access. But I'm gonna leave it at the raw, and you can do that on your own so you can choose raw and then test out the movement and then go to the leader, right? Could just access and then tested once again. And you can see what what is working for you. No. We are gonna check if our age is greater than zero, meaning that we are trying to move to the right side or we are moving to the right side. You are gonna say transport that position equals two news New vector back after two open up curly brackets or parentheses and then typing, transform, transform that position, got X plus our speeds and then put a comma transformed that position that why like that and that would send my color else if so else, if our age is less than zero, meaning that we are trying to move to the left side. Are they safe? Transform? Got position. Position equals do new vector to which will be transformed that position, start position that X. But right now we're going to negative side, meaning that it will be minus speeds and that saved will apply to transform that position. That Why? Because we are not gonna move on the boy position, so that will be it for our movement. Now we're gonna go to unity and we are going to test out our movement. Let's clear out our console. We're out. Let's test it out. So right now is cheap. When I try to move left, I'm moving the left side right, and I'm moving to the right side. So as I was saying, with these speed right here. So let's say you're not satisfied with the speed. You can put it to be fasters. Their points are aid. It's faster. You can put it may be too fast for you in stall with down. So like this. So, as I said, it's up to you guys. Did you? What you want to do? Exit is like you fast ask me. And if I put 0.1 that'll be like to slow once you're satisfied with your value. So let's And for seven what? You're satisfied with this value? You will remember it or caught with this because anything you change in the play mood. So that's I hear Put 100 and I get out of the play motor ago exit on. You have remained the same speed that I have started with. So copy that, and then that then just based it all over. So for this, as I said, we believe it at 0.6 and that will be it for our movement now one, but or error are me. But I forgot show you is that we can go out of bounds, as you can see. And that is not something that we want to see and how we are going to fix that. Well, we'll add our farms to the player, so let's go right to the side. So I learned here and this will be our bombs, which is two point big thing. I'm gonna call this number as it out of our planeloads go to our script at a coma right here and here I added Valence, ex bones, I mean eggs, Bones, which will be cue points. 15 f What am I doing, comma? And then bounds. Well, that's one way to do it in another way. Will be at one more product, both ex bound than equals to do 10.15. So this is the same thing. But this, like this, it's in one line. And like this, we have two lines. Sometimes I did until while sometimes I do it in one line. But as I said that things it the thing is up to you. So I'm gonna put it at one line for now and here I'm gonna check transformed that position that equals equals two new rector to. And then we're going to say Matt met using mathematical function, dot clan and is a critique, as the name says, clamps of value between a minimum float in the maximum vote value. So here we are, searching what value you want Clients. We want the fan transformed out position, position, not that position that X. That is what you want to plan with, what the value we want to clamp it with minus x bound and then comma and xband. Then go outside of the curly bracket. Add come and then transformed that position. That Why? For the what? So right now we are planting are transformed eyes position that X with minus x about an ex bound. So that will be with minus 2.15 and 2.15. Now, let's test out. We were breast our plate, which should not be able to move IEDs outside of these, as you can see. But I'm not gonna boot. I'm not. I'm not gonna be right at the point. I'm gonna test a pipe. Would like 2.3? Yeah, like this. So we could catch the ball so our ball does not get out of it. So I'm gonna leave our X phone to be 2.32 point 15. Not a big deal, but still it counts, so I'm going to change it. So, guys, definitely it for our movement. And right now I'm gonna leave the comment because I have explained What are these four and what are they? What are they? Are what are they saying? So, guys, that will be it for this video until next time I'm Amar and goodbye 3. Ball: What's up, guys? Each your boy Amar. And today we are moving on with our break Break it d and this video will add the balls bowled movement and everything else that needs to be down with the ball. So let's get right into it. The first thing that people do go sprites art balls ill at our ball five Now for our balls , life will change the name to ball. Well, uh, well, add sorting there for evolved to be ball course. As for our Bo put the sorting with balls and our ball is too big. Let's scale it down to 0.3 on Axe and, boy, uh, at our Circle Collider to D and add rigid body D, which will be the dynamic. So this will be it for the ball as we check If you have, I'm gonna skill down a big are Reyes. So it's it's perfectly like this. I'm gonna change this to this Teoh handle, cause this circle is kind of bothering me. But as you can see with this, we can change the rotational are evolved. But never mind that. Let's move on. What? Our balls, as you know right now, we have a rigid body surgical either meaning that are bad and are ball should collide with each other. When I press are start function, you will see they will collide. But educate t r Ball is not moving. It is staying in one place and one thing I will do will go to constraints and feed zero rotation, meaning that we cannot who are about undersea access arm in the rotation. Now one thing that we will need to add for our ball is it's here right now. It just touches the battle and nothing happened. Nothing is happening. Fix that will add are fuller who called physics much material like this. Here you go to, right? The guy it could create. Go to physics material. Do these physics material to unity is our program or more eso physics to the material and we're gonna call this bound seen This bounces our ritual B zero and our bosses will be one Now what are they at? This Our ball materials collided t add bones. Sister threw the ball. I mean And now when I start our game, you'll see our bottle bounce out. And as you can see, right now it is don't sing, so that is what our research for. But right now we cannot move left nor right with our ball. Even though we try to do, you just go right now, it just goes up and down. No matter how much to be our panel. To fix that, we'll have to go to our panel Scripts, open up our paddle and before me do that, create our balls, script, script ball. And I almost forgot Ball scripts like this had hold of all scripts. Then add ball script to it and to our volatile add the ball scripts ball script inside our ball script. We will delete the comments because that is usually think. I always do once we're done with that at our public float speed, multiplier and then constant speeds. So add these three floats for our ball. Then we'll have our public public transform, which will be our start point and last but not least, our private rigid body G. We feel called my body like this now, one more cute, I almost forgot. They are private bullion with he'll be can't move, meaning that if we cannot move, will be on the start point, which will be actually at our What's gold paddled Now change. Boys, start with awake because inside already function we're gonna come out are my body because to get components will get component and our components will be rigid. Body body too deep And what is awake Function? Well, basically, wake of function is same function as our start except that are great function Starts off first that I'm talking here Print, uh, awake function on this and under our stuff function I'm gonna name this start function Start and you will see that are awake function initialized first that are start and then our school begins so you'll see in concert right now when our start the gate Gaymard start the is we play, you will see a big function is called first. Now when with that in mind, I will, I mean personally or my perfect is to call this innovate function because that would be the first thing to add meaning that I cannot messed up things by adding now some values to start function. But if I were to do that in awake, adding some functions for the rich body, then calling out my rigid bombing start that caused some problems moving on in our update function with I say if we can move so if we can we are going to say I almost forgot. He will have shoot, shoot, have probable candle shoot. If we can move, we are gonna say, If we are not shoot, you should is not too meaning that we have not been shooting before. We are going to say it should equals true and at my body dot at force and it will add new active do so directed to So if you'll be zero for the X and for a while the speed times multiplier like this multi Blair year select this multiplier. Did you liar like this? Then we else we cannot leave. We will say transform, transform That position equals to start point that position just like that. What's this Will, Basically, when we should up our ball real say should is true meaning that we have should be insured it and we should from the white meaning that bullshit are from the why I will only change the why that's called position. That that's what I want say well, all they move on the white position moving on in our update function are they say, if our input so input don't get do you So get key down If we get our he cool Okiku That's face meaning that when we hit our ski code space will say can move equals True Just like that And when our camera is able to true will shoot up and do the rest Following I think And last thing that we will do is my body don lost e because to constant speed guns than speed where they can constant speed I miss belt See oh, stem J c o s t a n t c e o stance be Get this correct. Let me redo that constants b multiplying by my body dot velocity dot normalised just like that. And why that at these brackets, enough knows we live like this. So my body lost. It will be a constant speed multiplied by my body that lost that normalized. So right now we will go to Inspector tap in our unity and he'll at our speeds which will be , let's say, 4.5, our multiplier which will be 50 and are cost speed which will be five. Now, As for our start point or start position, that will be when teeth within our paddle through quick and get empty game object inside of our panel. So that's child in off our panel. Name is start positions start force like this. I will add Aiken to it and never left a red one, and I'll move it up. So somewhere around here will be our starting position for our ball. Just like that? No. I'm gonna copy this and add the ball. Let's see how that goes. Okay? Okay. Not there yet, but at vaulted. And now I'm gonna add the same so I can take everything is all right. And yes, it is now inside our vault will add our starting position. Starting point. I worry what however you want to call it. And now what? I start our gameplay. You will see that when you are paddle our bottom with us and when are past space equals truth out. But right now, we cannot move left or right, and that is causing us some problems. I mean that the game is not playable. So to fix that, we will actually have to go inside off our paddle. So go to paddle. Open up a script. Uh, come on, open up, pal. Script like this. And once we are inside of our paddle, the first thing we'll do is we'll add a new new variables. It will be in directions. The erection, which is by default zero flowed previous brave Eos, position Position X Then we'll have our private game object. It will be our balls and you'll have our private load Speed vault. I think that now our start function we're going to say previous position X equals to transform that position. That Why? So why will be for the extra our ball the equal to keep off dot find and it will sit for the vault Moving on. You know, we are linked at our late update function. Hope smell bad. This is not necessary. So well on Add the ball. I do not know why have debts, but never mind. Sometimes I go insane. In our avoid late update, we are going to add the following thing that we have added up there, which will be our periods. Position X equals to transform that position that X like that Now what's different. Been updated in late update. Basically update he's called out first than at the last off frame are late. Update is called meaning that our movement will be called first and then our favors position will check on where, Where, Where we meaning for our X now moving on inside our movement we are great at If our previous positions x our previous position X If that is greater that are transformed that position this tune like then thought x Denver will say direction It was two minus one or negative one else. If our serious positions reveals Position X is less than France for that position Got X I didn't say direction equals do what and last but not least else are directions. Direction is going to be zero, meaning that if we have not moved before now I need to add avoid on collision Enter. Oh, is collision enter to D And I didn't at this collision inside of our bracket. For them to say collision call is like this to be with the name which will we name target? So with this will check Not yet, but detect collision between our ball and our pedal So right now we're gonna say float, adjust. You posted three multiplies by direction. They're even by my direction. And then immigrants a target that region bodies target that which bought dot velocity evil Stoute new new vector to which will be target that region not common target dot rigid body dot The lost that x multiply by Is it multiply? Or plus, I'm gonna say, multiplied by a just just and I will say transformed our position that why so if it's not multiply its loss, But I'm not so sure. What was it? So I'm gonna check it now because I'm gonna test this out. Let's say what happened here. Stop are gay. Let's move. Left or right is going we can our ball that saving, That's it. What it's not multiply its plus. It's Plus it has to be, so it's either plus or multiply. Does this one more time? You can see we have some problems. Let's go back to our script and the Yeah, yeah, So everything is correct until we hit the come it's not trapped. Transformed that positioned up. Why, it's actually targets. Target that rigid body gin bar the don't want, just like that target the origin body dot The lost city doctor going? Yeah, and right now, we should not have any problems. Check. Except Oh, I can see the mistakes. So it should not work right now. I mean, it is working, but as you can see, it's not the proper way. And that is because of hard driving skill Put girls killed b zero, but leave body type to be dynamic. Give that in mind. Our body type is dynamic but are grabbing scale it zero meaning that it will be same as its king a magic, But it will have it'll average body lost in all that good stuff. And as you can see, our boat is working like it's supposed toward and everything goes out perfectly. Now, one thing that we can add I mean, this is if you want to. I mean, I did not have added it, but I'm going to do right now, so let's say when we move to the right side, I mean, we removed the right side. We'll throw down our ball to the right side of it when you move to the left side will shoot it out to the left side. So how? I mean, how are we going to do that? Well, basically, we can just check where where are we going? So, inside of update function, we can check something like if our can not him, but start going that Exxon got experts start point. We can under your start point. But we could go to paddles. I haven't I have an idea. So right now we are speed and our multiplier for the why. Now we'll add one more float so public float that you direction like this. I was involved here. It's a ball direction older that for our X like this now inside of our paddle, we are going to say if our if our battles, our direction is I'm gonna do that right down below so inside of here. I did not add these, but I am going to do right now. And the reason I did not add them. Because when you when you're doing an ILS or have statement with only one line, you you cannot nothing out but you. Can you have an option of not using them? Yeah, that's what I want to say. That's appropriate world. Now if you are are not not like this. So my bad. Undo this and go back to the void. Update here. We're gonna check if our direction he's great through Dan one. Meaning that is our left left side, I think so. Sure. Meaning. Now we're going to see if our direction is greater than one. We're going to save ball dot get components, ball, script, that ball direction. And let's say if it's a positive side, we're going to say people's to 50. We're not 50 but let's say 5 55 else. If our direction is less than one, we're gonna copy this off it. Put it down here and gonna say Negative five and else else we will leave it at zero else it will be zero. Now let's go on and check that out to see it. It's working property, so let's move. It's working, but you see, when you look at our body ball direction, it's only a negative. The positive side it's in the zero or negative Spence negative, and still it's not moving. So meaning that either we have to add more ball direction to it. I'm gonna for a second, I m. Bennett put this down and put our Is it our Bob do public? Why am I doing this? Well so we can debug What? What ball direction we have. I mean, do we need for our balls to move left or right? So right now when I start our game, I'm gonna put ball, directs to be 50 and then could space Sgtp when it's 58 moves of being to the right. Let's say we want to move it a bit more off the right to the end of you usually do. So let's say 100 should be fine and you're 100 should be fine. I mean, check that wants to be, Let's say 1 50 thing. Is your here? Yeah, not. I'm gonna leave it at 100. So leave these back private ball Directional state are. And now it's not five but 50. So he will see 50 and 50 now before direction is one if are greater than one that's minus so far my trust me, he's waiting. So I think I think it's it it needs to be if it's less than minus one. Yeah, not my less than one. But if it's less than minus one. It's gonna be negative. 50. So let me does this one more time to see if it's working. I'm staying in my place. Ball direction zero. When I moving left. Zero going to write it. Zero. We have to change this to minus and then greater. But check it right now. I'm not sure for what is the proper way. And yet, when we are moving to the left, it's 50 with rights against. So we need to stop those. It's minus 51st and then 50 ad ball direction. It's negative one and last time. We are testing. So guys is you. Concede it's all about testing when it comes this case. So memory to the right We are at the positive side when I'm on the left are the negative side. So yeah, just like that now is it is. It is working. Now let's go back and adhere. 100 of 1100 years. 20 hundreds. Election is zero. Our direction is zero. Okay, that will be it. So, guys, as I said, that will be it for the valve function. Everything is working the way we wanted one that it's the work I hope you like it. So yeah, it is going left or right, Depending. Where are we going or where do we want to shoot our balls? As I said, that will be it for this video. See, you guys in the next one hope you like this one. And I'm hoping you will, like even whether the next are coming up and up and up. But I know you're Eagle or Eagle eager to learn. So I'm just going to see he's out. 4. Brick: What's up, guys? I'm are here. And today I'm back with another win. Dio, Here we are going to create our first level. And to do that, we have to create the break to create break will have to go sprites good art. And then you can choose any break you want. I mean, any break you want, I'm gonna choose the yellow one, because I like that the most. And then I'm gonna add sort uglier for the for the break our brick layer. Now, for the bricklayer at a break player and then as a beauty, it's visible right now are break is kind of too much, So I'm gonna skillet down by 1/2. So it's going to be 0.5 for the X and Y. Now we are getting our box collider to see to it. Where is it? Or break duty. And yet it matches perfectly. Then create smolder. Call these pre fabs Open up that an ad break So break free. And at our big break, Prefect, right now, when we add our break, I can delete this and you know we have it or already loaded, so it's always gonna be there and we can add as much breach as we want to. But if I were to add if I were to go to assets price our ad break at him, Boss Collider like I did right now and then if I deleted and add one more break, as you could see, we have to do all that over again. And that is not something that we want to. So we are creating a prefect out our game object so we can create things like this. Now get an empty give object called this level one and at our bridge to the level one position it to be 00 Then we're going to duplicate our break one time to time. So fine, it will have five bricks now. Big break one. Take the move to put above and hold on a wiki, not W, but I'll be keep, but you have to be under moved to. Then just drag it on and it will be attached to do the same thing for the break. Do hold on a wiki and attach it. Break three. Although we keep, attach it and break for hold down a key and attach it now take everything and let's say you move it somewhere around here. Bitch may be a bit more up. I said I'm gonna leave it like there on Duplicate that. Moving to the right side as duplicate right side added duplicate right side at it and duplicate right side and add it. Now we have our level one, and we can change the position for it. And I forgot to reset it, but it's OK, is okay. So we can now move our break wherever we want is not there. So let's say somewhere around here should be fine. So right now we believe our brakes to be there. If you want to add one more line, you could always take these. Duplicate them and that one more to it and so on. But right now I am. I'm not gonna do that. Get some Pittis Satisfied. Released level. We have, like, 25 bricks, which is okay for the level one. Now I'm gonna go pretty bad. Create another folder and call this level prefab this and inside of our level 3 50 I'm gonna add level one now. One thing that we have forgot to do. East Ad attack for our break. And that will be our break test. It's attack our break with a brick tag and he don't applaud. I guess if you do not get down a blood, it will not be changed, right? Right now I can put our skill to be 10 10. And if I were to believe this so continue. Never mind fiber the ladies and add one more break. You'll see everything is that it was before. But if I were at a break and then put it to be 10. 10 and he don't apply it, feel applied immediately. Know if I had one more break, It will be 10. 10 at one more breaks, I can show you it's again gonna be 10. 10. But I'm not gonna do that because we do not need 10 10 bricks Put scale down 0.55 Don't apply. Yeah. And you will leave this one because it's not needed. This 12 to 25 bricks now apply. Get on the one. So we take back what we had and yet, guys, I'm bothered with these girls are break a Level one is here with bricks are steer someone to create another level ones level one recent. Its position at all these breaks to it. I mean, you did not have to do this, but I just don't like the way the boss, As you see right now, I can move it, really. And I know where it is. So delete this level one eat. And at another one, just like that moving on as I was saying, we have added a break. So tag all bricks with a brick tag and he done applied. But we have to add all of these. Magnum would break and he down white. Why it's not available. And now we'll hit down just why. And everything should be tagged with break. Yeah. And why do we have to do that? Well, basically, right now with our vault touches the brick not think will happen. You'll see that. Come on, don't lie. You play button fly as you see right now, not think is happening, but not at all. Now, to fix that, we will have to go to our ball scripts but evolved and open up our balls. Once we are inside our ball, scroll down a bit and adhere, and you function and that will be void on collision duty. Coolies collision. Enter, enter D we feel name out. It's out. Met completed date, But just change the collision to target. So it's not collision to the collision, its collision t target. And right here we're going to see destroy our targets destroyed our target dot king object with 18 0.1 f And then we'll add my body that at force or no, I will not do that. I just can't destroy the target. But we have to check if our target doc tag equals to that equals to break. Yes, it it's not our break. Then we do not want to destroy it. So target dot tag so target dot game object that tag it is to break. If that is true, we're going to destroy our object. Then you on our score Well at our cover off and our sound. So I'm adding these comments right now. Here. So So I did not forget about this. Forget Forget God said not get about this. And now we can go and test this out. So click on a play and we can see that it is working our boat is destroying these bricks, my right. Yep. And And they are done one by one, sometimes two, depending on the on the way Does it hit is like that on thinking about killing down a bit, our radius off the the ball so it does not actually always hit two off the bricks. So for the ball, another say zero going 40 eight, something like this. It's a bit smaller than the ball, this itself. But I think it will help a bit about these breaks. And I think we can even put our brakes a bit inside. So, as I said so are bald and not does not always hit two of them, but it will be possible when meets kept up a bit are boming that we have our what's called Oh are our big balls or very had our big bulb are power up past component values like this ? So yeah, it is a bit scaled down, so with our ball hits here, it does not always hit two of them. That's just one more time before I'd go on creating the next levels, and another one so produced with a will create about three Laos come on. And yet it is working. And right now, yeah, it is working, and right now we have no problems with it. And one thing I want to mention that is why we have to destroy our game objects after 0.1 2nd But if I were to believe this, you will see that our ball will go through them like they are not. So it will not bounce back off of it and to add more scripts to it or Desmond bots off back of it. So, as you see, it's not necessary. And I thought it would be. Or maybe I did not say the function I did. Okay, it is working. But I could clearly remember that if I were not destroying them after some seconds, they would not Bond's back off of it. It will just Pitt precise, go through them like there are no break, but OK, as if it is working this way. So I believe it. As it is, there's we have no problems with it. And yet, so guys, that's a bit it for this level. Let's go on not in our script, but in our unity and create level two for that will delete are level one from the scene. Great and empty. Give object called this level love too. Assets Prefect, break prefab and add our brick to it. Now, for our level two we're going to do this is not the same thing, but kind of different. So I'm gonna position this right here. So have 1234 forces say aids one. Put it down here. You know the drill. Hold on weekend at its then then Ban. They have five. I six. Come on. Thanks. Said that seven. And that aids like this. Come on, Wiki work like that. Then we have less meaning that you add from here to here. There. Then add like this. These three and Adam like there. So copy all of that, put it on either side and put skill to be negative. 0.5. And why this is not rotating, Okay? No negative 0.5. But these three let me find these tweak. More work. But are they these or like, this will be added inside of here. And these three will be inside off these or like here. Now dig the whole thing and move it somewhere around here. Okay. So, like, this will have to move a bit more edges. So the ball has room to go to here, here or in the middle. So I could this something like this should be good. Yeah. So that is going to be our well, too. I'm gonna go to prefects level and that level do. I'm gonna play it a bit. This tested out. Come on. And yeah, it's not working because our bricks are not tag. Who? Three thefts break changes to break back like this and at all of these brick. Well, here, I'm gonna add three more inside this. Go to CNN. Where is it? Find these three. Go on, duplicate and put it inside. Meaning that you'll have Teoh move. Not this. Talk to this from 16 to 31. Move it. And what year? Now I can move the whole level and I'm gonna leave like this. This is going to be our level two. I mean, if you do not like it, you can change it. And I will just great to levels because everything else still depends on your imagination. So if you're not sense for with ideas. You could change it. You can do your staff and so on. I mean, I will create one or two more levels where I'll add a bit more stronger bricks and I will show you guys how you can use those bricks so will not destroy them from the first hit. But they will be destroyed, let's say, from the second or third hit. By destroying them, they will actually even changed. It's changed there. What's called changed their sprites so they will remain the same. They'll go from blue to yellow to red until they are gone. So guys are more here until next time. Goodbye. Hope to see you in the next videos or upcoming radios. So you learn more of these more of these good stuff. So God just tell right now not know why you are repeated every single time. Goodbye. And I will see you guys in the next video. 5. Brick2 And New Level: What's up, guys? I'm are here and I'm back with another We dio right now. As you can see, I have created the level tweet and I'm gonna go breathe to it. Explain how I did it and what I did because I didn't did not want to spend more time on it because it's not needed. So you leave the same brick so yellow bricks for the poor to create one. So let's say you create this one than you duplicate that. Put it down, hold on weak and attach it. So that is how you're gonna do that. The first step, the second step is create goat sprites art put down our brick one add box collider to D size dot for dot force Or one thing that you should keep in mind is that I have put our bricks to be a 10.4 so they can fit like this before sizes and what you're done with all bad could sort were break and now our bricks should be visible. Then you put it down as our brief hat and then you did the same thing duplicate, duplicate and we keep just like that now going on you'll actually have to go into the same thing for the brick three, which is always the same thing. But just another sprite. And what do we need these bricks? Well, right now we're gonna create our script that will change the sprites from the bricks. So right now, when we start up our game, you'll see that our ball is Detroit bricks with Army one hit not down, but yellow tactic. It is destroyed on Lee by one hit, but these are going to be destroyed by two hits. And when they're hit once, they will change its fight to yellow. So did you. Dad wrote. Scripts go to patents trip, not go to create New for the rhyming call is brick script and then create here. See a shot script that will call Break Now add those to break to you so these breaks blue and brown. Add them on. So break dude three like this and words to To at you are brick script. Open it up in my developed or visual studio, depending watch prefer from Here are it's pretty simple. You'll have Here are publics public yellow brick, public's pride. I mean, yellow, yellow brick no black and yellow song. That is what we need. Black and yellow. Just getting Daniel have our privates. Private Sprite, right? Renderers the trend, right? I did. Rights is strike. Rend the air like this, which will call break, render brick Rather then inside our start function, we're gonna see break, render equals to get components get component and you'll get our Sprite Sprite just like that curly brackets and Sam my column inside our update function will have if we could check if this if this referring to descript whoever it's attached in this script meaning that these four bricks and have blue and prom So this Saad game object the object that tag equals to break this equals to break. We're going save break Rendering dots right equals yellow brick. So what is this? So basically, we are going to have a separate tags for our brakes going to tags and you'll ad tag to so break too break June and add to the break to break you too. You end for our bricks. 333 Come on. What? I Not that these. So to do this click on any break you would like and then fold out control on your keyboard and then select any one you want. What's do That tag name would break, too. Just like that. And last but not least, thing we need to do east at the Yellow Breaks Go onto here. Click on this circle button Here. Here you will sit for the break or maybe want for from yellow to baby to this morning to this one. So I mean, it's up to you guys. I just by the ball put our break to be yellow. So it's up to you, but sprightly you want. And it's up to you. How many times you want to change this, She can say if so else. If this game off that equal slaps a brick break to the legacy of bricks, render dots bright ables to let's see below break and so on. And then you will have break three and you'll actually need three times to hit the brake so you can destroy it. What? I was saying that we need to go to Sprick, scripts them ball and open up our balls trips right here. Once you're here, you'll say. If so, if our target that tag game object, doc. Tag equals stoop. Break Do. Then we're gonna say, target that game object. That tag equals to break one. Just brick, do you not? Double time equals with only once equals to break. Now when we tested out, as you can see our script and break we check if our brick is break are gonna put that to be yellow So you can attach this every other brick if it's needed. But if you ask me, it's not gives by default. There are they are our young So right now I'm breast here and see break gone And right now it is not gone but it actually just chance price to yellow. So go back to our script. So I will explain this one more time. He'll which out for our break render which actually this here and go on to our inspector This here Once we got hit by Sprite Real change that bus pregnant but by ball will automatically change to yellow Sprite and it will move on with our game. So here our ball We changed that by changing its target and it will have to do the same thing for here, so we'll have score up sound power up. And that will be It's so, guys, I hope you like it. This is it. And until next time I will see you in the next video. 6. MainMenu: What's up, guys? I'm here. And today we are going to look through some off our unities. You I Well, basically, for now we are not gonna touch gameplay You I That will be the next video or a some of the next few dues right now are going to do may menu get meaning you are. So for that you lead another scene to quit another senior goto files top left or Raisi file and then you see shortcut to it is press control. Plus And once we have created the new scene, we'll have to go to file and that's safe are seen or press control. Plus as if you're in the windows and command loss as if you're under Mac. When you click on save seeing go to scenes and hero at Main Man, you just like that now in our mean many scenes will go to two sprites or and heroes urge for our What's the goal that textured things? No, no, no. Or full yet inside of buttons at image home page and this will be our back around in it. I am geo image inside our background image. We're gonna right click on it create the mother Isaac iron the right click on the hero. Keep great in you. I and he will create a button. As you see right now, when we create are you? I automatically we come with canvas and have insistent kids. Is there so every you I game object has to be a child or canvas. So any time you create your ology, Targo say, Rhyme is But say you I text no matter what we create, everything will be under the canvas because it has to be. It has to be a child. Are tens now for our but in the text image will not be needed. And inside of our canvas, I want to talk. We have a three different Brenda Rhodes wanted space overlay. Second is screen based camera and last his world space did. They are going to look on Lee for our skin pace camera most of the time you are going to use, or most of times it's your screen pace, overlay and worlds place. World space is usually used in three D games, someone like F B G O paroled and stuff like that. Now provisional press screen face camera, then click on the red camera, and he will go to see an attached army camera. Or you could just drag Army camera into this. Once we do that, our campus will be right for our main camera is, And right now we cannot see our button. And that is because the layers so press backgrounds or the canvas and put back from or the V G Now for the background beat you even, say, minus one. So our buttons and everything that it's inside our canister is visible now for the canvas scaler. We're gonna say skilled screen size and our screen size is for 80 by 800 and putting down 0.5 so we can match with and hide equally so for cannons. As I said, we owe the declare. Sorting layer will put screen based camera and good screen scale, but screen size for you ice killed. This graphic Ray Kassar is for the buttons. I know Eman system is here so we can detect, button, click and stuff like that. If I was delete this our but this would not work. I will true that later on, but right now, boot buzzing name this play, Maybe played and put anchors to be in the middle, then put 00 for the width and height. Now for the source, image will look for circles of legal circles, and you'll look for Bt and Blade but set native size. And as you see, it's perfect, But it's kind of too big, So I'm going to scale it down by holding the shift and just like that, or hold on shipped and skilled it down. And then again with 00 So with will be, was it 3 50 I will be 90. That will be for our play button. Next up will be our quits. Duplicate that by a classical trope plus B, or you can right click and then duplicate the button. I want to duplicate that. Rename it to be inspectors to rename it here, and it will save wit like this moving down, moving down the beds. So that's a summer around Los over a year. And now we are going to change this to B. Where is it? What? What just happened? Now I'm not Don't ask me. We will change to quit just like that. So minus 1 41 or the one will be our quit and zero will be for the why from both play and quipped, Now, now, when we start our game, when you click on the buttons, nothing will happen is the tea we have, But they're clickable, but nothing is happening. Why is that? Well, when you look inside our button inside of the inspector dead, you'll see Here we have on click. We have to add that. But do that We have to add an empty game. Orbital quick. You know, Iraqi empty game object Recent its position. This is not necessary, but I like to my game obvious stock off 0000 named. This made Manu controllers stroller like this you'd asset scripts here are gonna say forward controllers, throwers, patroller script and inside that here we're going to say C sharp scripts, right click, go to great seeing sharp script And then this made many controller just like that. Now I have made one mistake that controller script but controller scripts I'm going to rename this for or scripts. By the way, how am I changing this by not double click on it? So just click on it once and then press after two. That's above a number two on your keyboard left stop side. So after escape and F one you will see in F Do click on it and you can rename it or it could just scratch the card and flick your rename changed the need. Enough of that. Go to Maine. Many controller add on our main manuscript and open that up in visual studio or more developed, depending on what you prefer, the more once we are inside Army menu controller, we'll have only two functions and that are not gonna be able to update or would start. So we're gonna do in them before I start. I'm gonna adhere, using so yet using unity engine dot scene Steve managements and meant just like that. And we will use unity, years and unity that seem management So we can't change from screens to seem to same. So we can go from a menacing to placing, and to do that will have great our public Boyd lay in curly brackets over branches and then Carly brackets, and then we'll have another function that will be public. Boy quit and then garden brackets and parents. It's never went now for the avoid quit. We're gonna say applications application dot with for a disease that my calling right now we cannot test are who quit function. But once you add this, you could go toe, build settings, build your game and then test it out by yourself. I'm not gonna do that because it will take some time and now 100% percent sure that this will work out. As for our public, Boyd played with Missy Seen Manager and got loads scene. And then you load our game play scene just like that. Now go back to our unity and we will have did tag not would select play at our quit button so detectable with click or Y Hold on control and click on another one. Add on click so ticket for plus so we can add on click add main menu object And here you will see function I will click on the on play and put function to be lay. As for our with or put to be quit Right now everything is done except we have to go to build setting scares. If we did not do so, the script is all right everything is fine, But now when you click twit, as you can see, we cannot quit out of the unit engine. But when I click play, you'll see we have a problem. And that is seeing gameplay could not be loaded because it's not been added. Bill settings or to the acid bundle has not been loaded. What's visible. Basically, when you want to go from scene to scene, you have to merge them inside our build sevens. So go to file build settings. And here we have at open scene, which will be our made manual. And I'm gonna put me in many to be a zero supposed to be a zero, because when you start up our game, I'd not want my game to start from the gameplay. But actually, I want my game to start from the main menu and the give all open from the scene zero, which is actually write down me many. I actually not remember when when did I had to give way? So to do that just go to give play scenes, same thing gameplay, scene, build settings and add open scene. Now, when you go to Maine, Manu and right now we're not sick on the play button. We are going todo game plane is going to steal right now and I simply will work as it's supposed to work. So, guys, that will be it for the main menu. I There is nothing else to talk about, for there is nothing else to do. So I'm not here and I see you guys in the next video. 7. Gameplay UI: Welcome back, guys. I'm are here. And today we are going to look through some of our game for you. I so right now we're gonna just make it, and then we're gonna script it out. So I remember in our previous video, which was a main menu, I we have created a main menu controller and all that scripted and so on. But in this we're there. We're just gonna create you. I this place where you can see what kind of you I are we going to use and then in some of our next videos I'm gonna script that out later on. But never mind. Don't be bothered by that. Led. Just get started. Let's just get something yet. The first will create your canIs cause you know, canIs is needed. That this over here, I'm not gonna touch anything. So any of this will be not touched. Everything will remain the same now, inside of our tennis, I'm gonna create a new image. But to be on the top and called these with cold is called this top border stuff. Border like this position will be negative. 20 which will be 463 and height will be 10 by So 65. Because I see there was some problems that I saved, but their minds. As for our color, I'm gonna put this color, which is kind of Bush. But right now you can copy the RGB a or just copy the taxi hex up that that small accident small which is 213 c for do literacy for F or you can go which will be character the three g 60 b 79. So this is going to be our top border inside of tough border pregnant had another image and this is going to be our life. This is our life So that's vicious. Let's position this summer on the left of native 1 52 and here we're gonna use the same sprite image to be used for our paddle. But we can Hybl the oil smaller So 98 for the width and height will be 22. So it's kind of visible inside off our life. Regardless, have our life score so you I text will be needed and this will be our life score text inside of our life Life score, text We're gonna say negative 31 or why it will be middle middle. So Elijah will be middle middle with the high remained. Almost the same thing is gonna add one to the heights is maybe 1 30 Fun size will be three to have somewhat of three lives and cholera would be white And right now I cannot see it. Come on. Three off one side tax will between with fun size with the 29. So that is what wasn't visible. And for the corn, we're going to use the phone that we had inside our project, which is the b x l and e w new underscore. I hope I'm spelling this, right. I mean, correct. Yeah, I am moving on. Next up will be Are you my button, which will be our pause, but it's false, but And we're gonna leave the text for it because it's not needed. Where you guys for your ice price? For you? I Button, you're going to say pause, Haapala, This button I'm gonna we have for the game. We have this one, but I prefer this one that I found. It is actually free to use roll free and with high will be 50 50. I'm gonna put it to be on top rights and top it up, not top right. It's only right on. Let's say how we put it in the middle and put negative negative but more 90 and negative 74 Dewie, and that it's for the possible moving on. We will have our score text. So you I text call is poor and inside of our even state score. Next, I'm bad score text. He wouldn't leave this score. It's going to be the fund that we have used for the live mil mil. Cholera be white because what is the best? So I'm just getting not the best. But I used the most of the times, which will be Let's save 3 13 and I will be 59 now for the fun size. I'm satar defy. So this will be our sport test and our sport that say Score one on 11111 and we have a problem, not that's too many ones. Life in 0000 are actual be 32 suits in the mill. Let's say 33 and our while being negatives. 18. Negative 18. So it's somewhat in the middle. Just like that. Do teeter 30. Yeah, this looks like it's in the middle. So that will be it for our score that we can move on. And right now, when you click are the pause button We want our paws penalty pop out. So for that, we're gonna create outside a partof border, gonna create you. I panel there is our battle inside of it. I'm gonna say color to be the same, white, but put everything to be at 2 55 So even our a source courage will be our method Blue pants like this and wait and hide for the metal blue panel B 3 73 and hype will be for 05 just like that. Now, put it to be anchors in the middle, not stretch, but at the middle and inside our metal panel. I'm gonna say it's uncle this past month cause panel and inside of our past penalty have will have our text. You know, text, we feel be art pause. We deposit or gave over's not that I almost couldn't charted something. Never mind gave over. Give over text was Will have paused for the game overtaxed, depending on the pause Or did we have finished our game? So why will be somewhere up around here to be one for the 61 45? I'm gonna put a larger to be in the middle, which will be, let's say, stretched so we could put our stress to be when it comes to next. And fun size would be for these nine. So 49 like this wretch. Come on, Stretch or not, I am veneers alive Mints. So here, reading it one for the tweet And you can copy the wicked height. So it will be 372 and hype will be a say 59 I miss or 6 60 I mean, nothing is changed, but I'm gonna leave it at that. And this will say Pause for now. Paused. And now we keep with any color you would like so you can get any color you want. But unusually, I'm usually using the white one and it's going to remain the same. Then we'll have inside of our paws. Been, will have Are you my button, which will be our play. And of course we'll do it the text and add are writing the play button, so let me find it. And here we go. This is our play button that is called next, but you can use it as a plane with will be 1 40 haIf will be one for these same width and height for the X negative 80 and negative ones. 117. Then we'll have our home buttons just duplicates play button and pretty to be a positive side and just changes to home, not who is home. So just find this image what, mainly not home but main menu. And I'm going to call this home so that will be it for the hospital except we have at our high score. So here, we're going to say you, I you are high score. I mean, we'll add you text I text and even in his heart, heart squirreling this and in our high sport it's under gonna say Hi Hi. Score. And then these you these two dots right now for our high school? We're going to say to be it's four. Why will be for the for 0.5 allies Mint middle middle font size will be 36 it will be the white color right now. We cannot say our fund size, I mean high school, because our phone sites is greater than our weight and height. And we're gonna changes by adding here, do 50 for the wait, it will say are high to be seven between that seven like death and I need to change our sprite nuts Private funds. So this is a high score. Now we will duplicate that and put our high score inside of our I score the bill at your high sport text. Now, our high score text is actually gonna have some value. So that c this much we will say Negative five for the why and for X lunging being that more announcing that it's not negative. Five, actually native, that's a 55. But in No. Five, Yeah, I can see that working out and doesn't it for our high score right now, we're gonna put our possible to be off because we did not want our past panels to be on when we start our game. And yeah, that's what it So, guys, as I said right now, sorry about that kind of stupid head. As I was saying, This will be it for you. I gave Lee Hope you like it. Hope he did not get bored and yeah, that will be it. 8. GameController: What's up, guys? I'm here and I'm back. Well, I'm back to work to scripting today we are gonna start scripting again so we'll have our empty game objective replica of the hierarchy in create an empty game object reason its position and call days. But at some point, you called this game controller from this. Now we'll have to add the script to our game controller. And to do that, go to scripts, controller strips. And here we would create at C sharp script if you'll call game controller. So we have good, uh, a patrol strip right now we have to just attached to it. So click on it. All the downs dragged on to our game patroller here are Key and Walla. We have added the script right now open it up so we can start scripting. As you can remember in Armenian manuscript, we have added something called using unity engine dot c men, Man, she meant like this so we can go from sea to sea. Now we're gonna add one more using unity engines unit engine and this one will be that you are So we get so we can control the u I from with him the script with a in the script. That's what I want to say now, as your instructor, the first thing I usually do You believe the comments? So I'm gonna do that right now. And you were gonna add some vegetables. The first will be our public text on the text. With who? Calls or texts. Then you'll have a life scores Life, sport, text. Do you have our eyes or text? And last but not least, will be Our paused text right now is conceits. I've added to calm us in between so I can separate the text from the text. That's one way to do it. Another way will be to create public tax. Had this got got that. But it here then send my column and that copy this one. Well, here I do like this till the end off our our variables. So exactly there are two ways of doing it. So pause, Waas text. I prefer the other way. This one I mean, it takes a lot of space that it's not needed. And right now, here I can put the text. Then I will have to separate text from Luttig buttons and separate, always from the game objects and so on. And that will take a lot of space. So right now I'm gonna undo everything I have done and put it as it was before. Next up will be our public buttons off button, which will be our play, Beaky and and our pause. Next, we'll have our public gave object which will have our paws panels, hospital and our public gave object off in a race at these. So these are likes great bars and these in college level. Then you'll have our above. This will be our public Sprite. Sprite? That's right. And that will be an array which will have hope. Place price, please. Bright And last but not least, we will have our public non vessel bids on Lee. Please spread. I want to add something more, but actually it's not needed. But the thing Well yeah, yeah, that's a big that will be it. Now, inside of our game controller, I would do anything for it will go to unit engine and attach these to give for And after that we can start scripting everything else out. So, for the score text, I'm at score text like this for the life sport text. I've been at life score test for the high sport text at high score text for the pasta techs have been ad boss text and they have play button and you will have our pause. But is it heart pause? But and he would have are pause panel. They will have art, please. Sprite with will have to sprites and one will be our next next and another one will be our But is it our reap? They But so when we dog want I replay the shows of this this image we want to be shown as for our button. But when you finish our game, we want to have the next panel on or when you have, or when we are in the pause battle, we want our next image to be shown. As for alleles, we are gonna have no levels are not supposed to be year. So lead the levels. That's in a nondescript not in this one. So yet that will be true. How are race, product and pause Right now I'm in lead these boys off the start functions because they will not be needed for now and here we are gonna have are void next next level panels like several pen curly brackets, Perec disease and so want. Then we will have our void. Next level levelling this parentheses, brackets Next up will be our boy died when we die. What panel we want to type in then you'll have are void. Pas spends boss for button. Next up will be are void are pause, pause and possibly be public public. Boyd costs like a boss Boy, I'm pause. Same thing. And then we will have our public boy play again. And you? That will be it. So right now, in our next level panel, we're going to say time dot time scale used to zero. We put our time that times get to be zero. That is very stop our games. Everything we came within a game will be stopped and I'm gonna show example later on when we add our Paul's, then you have our paws. Panels are possible dot set actives acted like this and it will be true. So we'll activate our hospital then for our paws pens my hospital before our pause text dot tax equal to our text when we finish our game will say, Well, well done, Ad some of these. Remember the neighborhood, but never mind. You know what I'm talking about, then are you going here? We're going to say, Pause Beak and the in they're back. The bolt direct herbal equals through one thing I forget I was a common debt out at heart school, so we'll add this one at our high score and he'll have our high school text week on our paws panel are pause button dot direct Herbal East Truth, and you'll have our play bot n that all clicks on flick meaning when we click on the button that removed, removed all listeners. What is this going to do? Well, let's say our play button has remembered that AIDS replay, meaning that it will always talked our need. But when it's next level panel, we actually want not one our play button to repeat the same level but actually want to go to another level. And when we do not remove all whistle with us, well, maybe add that one that was a previous on. So we will remove every listen. It would be half that will see play that it. The Sprite Eaton's too place right, which will be at zero, gets a raise, start from zero from one and then we can save play Bt and that on click. And now we're gonna add our listeners. Add listener open curly brackets, open another one, blows it up, put equal sign and then arrow arrow to the rights And here we're gonna pass on our next level, just like that's of curly brackets. And that semi called So writes How are play button will be adding So we will be adding on our play button. We will be adding in our play button blade dot on click the add listener and that will be our next love inside of our Nextel are going to say pause panel God set active to be false This time dive time scale will be equal to zero And then we are going to check If our level counters this comment If our level counter equals two it is, then they are going to say something like our balls. The move will go back to its lays and we will at level another at no there level when this So we are going to do this one. We have our gameplay controller like we did not have its original you provides with the comments. So when you go back to the script, we know What are we missing? Moving on When we die, we're gonna state time. God timescale. He was 20 Then we have our paws panel set active to be true. Well, how are pause? Text dot text equals two game over this anymore. Our ice for then our paws beat and in correctable will be true Are trying bit dispute things up because everything will be a bit repetitive. He would you saved play. Bt and dot All click on click are actually I'm seeing a copy. This carpet is over here. He's over and it will be not next level but again. And it will be not spread. Zero spread are possible in, say time that time scale to be equals zero Pause colonel dot Said active to be true trail But true like this and you'll have our fast text the text Sane, False. So we know what? This up you at high school. Then we will adhere our play buttons, lady. And so I'm gonna copy these one more time there's over with this part average to be again. Zero spread image will be zero and hero Put our on pause and our own possible Be saying time that time skilled people to one And they even say fast panel that said activity to be false And last but not please our play again will be saying seen manager the float seen load off our game Blame See Gate, please not seen. I'm gonna go over all of this once again. And then I moved on to pause Panel right now is that you have created are void next panel inside of people's top Our time put our past battle on and we were going to say Well done. Congratulations. You have won the game. You can move on if you would like to. It will move on with our play button by removing its always nurse and adding another Lisa That will be our next level. Next up will be our paws panel which really sects have activated befalls times, guilt thought time that times could be zero and we will put our little counter and check where we where we are at. Do we need at another lower. Is this the end and so on what I will say that they have died and we have an option to restart a game. Boston A would pause our game. I'm positive on pause. Play again again. Now go back. Our brick breaker in the game engine. So immunity search for the cause. But okay, we have here possible at one click ad game patrol And once we are adding, are pause. We have added everything. So now I can show you guys are pause. It's working so late on play right now is you see, I m We've left, right ball is going with dramatic pause everything. Everything stopped right now I'm trying to move and I'm able Why? Because I have to go back to script that's go to Where is our paddle? Go to our script and I will just add one teeth. But I mean, our battle is moving, but our ball is not so here. I'm just going to say if time thought time skill, I just kept equals to one. If that is a good one, we are going to move right now. What I test. It's one more time we can see Amway left to right. You could see left, right ball. It is going to. But when I hit pause birth, I cannot move. I think you can hear this. I'm taking a or D as much as I can, but I cannot move. And as you can see, our ball is not moving too. But then when I click on the play button, we are I'm pausing the game or resuming. But when I succumb, paused and then I go. Come on, boss. And I go. And this one, it's not added yet, so I forgot at the home button. Wait, Did I actually do that? Yes, I did. So I forgot. At here are public's public boy whom? Yeah, I'm gonna call it home. And he was just going to copy this one. And here we're not gonna say a game plane, but made men simple. And you now do the same thing as we did before. At on. Click at one click, but only one. So click on the minus when you want to remove it. And on the plus, when you weren't at Adgate Controller, you are you patroller foam And that's this out the last time. So this video, I know it's long, but it has to be so I can explain things as much as I can. And so you've got understanding. So you can. Guys, I'm just standing Well, now when I go home, I go home, play oh, play home And right now we are going from sea to sea So, guys, that's a big gate for this video I'm not here and until next time I will just say good bye 9. Gameplay Controller: What's up, guys? I'm are here and I'm back with another. With Leo in this lesson will be adding our game plea controller. Now. One thing I want to mention is that we could create a separate empty game object recent its position in college days game play controller. Or we can rename this to Let's say something like Game manager and add everything to it. I personally like the way we create more empty game objects and that we can if we have too many, we can always take you, make controller and then added in there. If there is need, of course, so you can. I mean, you can go here and add our gameplay controller script that we have to create. So right click on create See shop script a name it gave play controller. So I mean, everything else is up to you guys. You can add it here. Renamed this two game enger create a separate game to game object just like me Or just as I did gameplay controller and add gameplay controller to it. Now open up our gameplay patroller and we can start going once we are inside are deeply controller The first thing I like to do is to lead the comments and that is what I always do. Once I have to leave the comments, we'll start by typing in our private game object game jet like this and we will have an array of game object so great in a rages at these brackets. Then we'll see bricks one and breaks to like that. Then we will have our private balls crypt which will called ball work, not know that yes, that's will be needed to move on. We'll have our private and counter brick brick counters, brick counter and our level Cantor, our level counter by default will be one and for break will not touch it. Then we are going to have What's this? Okay, we are going to have our private integers private and which will be a life which by the for me too and our private bullion died just like that. Now, inside of our start function, you're gonna say ball equals two game object than dot fine and your research dot find objects off type object with object of tight. Oh, Jack off type said nothing spell and we are looking for the weather hot. Whoever has the ball script in it. Daniels have our scorn here. Scores set zero. That will be later on update with Skip it for now, who at our avoid break break counter and our Rick candor will be activated in our of the break candle in this. Now inside our brick counter are going to state breaks one equal student games game or object game object that fine game objects game objective said as I mean objects which text gave off the object game objects which tag? And we're searching for the brick tag. Once we have done that, we're going to do the same thing, but not for the brick one, but for the brick to and we're gonna count. Break to this. Once you have done that, we're gonna say our counters counter re counter, equal stoop breaks one that length lost breaks. Do that worked. And why are reading this? Well, basically, we're gonna count out how many breaks we had in the unity or in the game play. Then we encountered. We want to count out until we have zero, you know? So we are going to say something in our village will be if and doesn't it? If our let's say counters counter recounted equals zero and our level counter equals to one , we are gonna call out our next level panel and we are gonna say, low candle plus plus like this and I've got at these two evil times so that is something that I have to do. So we're gonna count what are brick counter is done. And with Arlo counted them will at our level contribute plus plus meaning that we will open up our next level. So for now, I'm just gonna test this out by saying bring your print brick counter like this Deceived. Everything is working. So we have added a script? No. So create an empty with an empty game object. Call it game Blade controller. I believe we have added But I did not say something has to be never mind Reset its position And at the gameplay script our game please Control. So now when I press play, I'm gonna click first collapse here once when I click play, we should see here. How many bricks have recounted armory Challender has. What's this Gale down 25. When we finished, I'm gonna say Stop, Go back! Script. And here I'm going to say Brent don't so like this. So I'm gonna test if our even if statement is working. So let's do General Quick play. And then we have 25 to 10 you want when me That's best are level right now. Eight deals. Almost 16 working. You could see you are collapsing. 10 seven. This is is a Well, of course, the first level has to be easy. But right now we should I'm gonna pause the game and bring back our ball. Zero continues because we have not scripted yet. When our ball dies wearing loose health are going to do that later on. Come on. And last one deposit, where is my ball? Click on the move toe and put it back here and we are done. As you can see, we are done. It is working. So you believe this and then typing here else, if not else But I'm typing just if our brick counter equals 20 and our level counter posted to the next level. So Faneuil, at our level counter, we will go up So, guys, I'm gonna leave. This are brick counter later on will learn something else. What? We're gonna do it in separate videos so you can always find that you can make betters. It's not like half hour longer, even 40 minutes long video surrounding this part by part and basically the same thing. But this in parts over here on. Good bye, guys. 10. Setting Up Score And Highscore: What's up, guys? I'm are here and we are day moving on with our gameplay control scripts. So let's go do it and not waste any more time. So in this video are gonna have our score implemented. So that's Goto our ball and open our balls ripped up inside our ball We are gonna add you parable which will be private into your score This then, if you can remember, he would have with up to at some score. So here we're gonna say score plus equals to 100. And what's this? Every time we have hit the game object which is tagged with the brick, our score will go up for 100. So score plus equals means this score equals to spore plus 400 But it just a short cut When you put plus equals two as you can see it the end that operation plus in left and right does not expect anything. Never mind what I'm saying. This plus April thing is saying score score plus 100. So we are having a Blust. Do you want to hunt me? I mean, we are adding 100 to our score. That's right. Now our score is 100. When our break when he hits are red, you weigh 203 104 105 100 so on. Then we're gonna say the layer. So play of press that set indigenous to just fall over. Now I'm explaining later said integer, We're gonna set our squirts score with our score injured. What this player preferences? Well, this player preferences stores and access player preferences between game sessions, as you can see. But with our Player Preferences Week in which out from anywhere we want in the script, we go to Maine than you. We can hear safe Pillay or player crafts. Then Dodd getting teacher, and we just have to have the same string key. So have so I will have score. And then there we go. We have our score inside our play function, even though it's not needed. But my point is what this two balls never mind. But my point is that we could access from anywhere we want, and with our player preference, we will have our high score because its stores and then we can access whenever we want, so I play right now. Game after tomorrow I'll comeback player presidents will remain the same with the same key or sinking. Yeah. Now this is an optional. So I'm gonna do the same thing with that. I'm gonna copy this and did the same thing for our break to. You can always put when you destroy the whole break, which is just letting these here. But I put this down even for our brief too. So now inside. Argh! Amply controller. We'll have to say at the beginning of the game that are a layer prophetess. That set set set into the our score score will equal to zero every time we have start up a new game. Then inside, we are gonna have another function which will be our voids. War counter can there. It's not counter, but scored text function like this when college score text function because he sees war text that next. What's happening? Okay, it's not in here. We have actually put that in our game. Controller on my right. Yep. We need had hit at score high score. But Okay, right now, I'm gonna show you one little treated. I want to show you later all but it's right time, right Now you're gonna save public game public static, static game controller if you call in ins, Tex Right now, when you put a public game controller to be an instance, we can reach out from anywhere we want. But do you have no problem? We'll have our boy away function with awake and here we're gonna say instance equals. Did this difference between Boyd a vague and avoid start function, which is basically the same thing? They're both used for insulation. So when you start up, our game there will be both activated to initialize scripts functions. But the thing is awake a big help out first. I mean, it will be awake then will be avoid Start right now. If I put here a friend awake functions way so we could make a difference and then we'll bring down he would start. And right now, when I click, you're under plate. You will see in the console that are awake. Function will be called first awake, then start. And when it comes to, these are kind of sensitive you. Where we have to put them like this instance is this I want to call that as soon as possible. so I'm going to use a vague function instead of start And what this public stand again. Right now, we need to reach our score test, But at it one more time here will be kind of troublesome. So I'm gonna do, like, here, gave controllers in controller dot instance dot score text That text equals two. And we're gonna say score than double days than ad space. So there is some space between Los are for layer preferences. Get into Jeffrey. We're getting our score just like that as extreme. Right now, we are getting our instance with our score. But there is one problem. We could only do that if our if our variable function parenting is public right now. If I put your needs to be private, I put it to be private. You will see we will have problems here. We cannot reach do its protection low. So go back here and naming public. And right now I think we have I mean, I have put this wrong. Let me check if they're at its place. Yet The er there I thought if I put this to be private, everything will be believed and I will have to add these one more time. But actually that is not the case. So yeah, And if I have not been here this instance people to this, I will have the same problem with the same problem. But I will have a problem with where it will say no reference exception. We cannot reach the function girls. It's not even there. And I was treated that later. So you had database for our score. Leading tested out. I pressed hard. Our score right now should be zero. And yet it's not. And yet I know why. I did not have called our score functions. So score, text, funk from shows like this girl Obrecht, it's and semi color. And right now it should work. It should work. Press play scored. Command score your zero. They And yet it's constantly moving as you can see, as you can see. Yeah, and I'm pretty glad that is happening. So that is work you we have get We get that out of our way right now I'm gonna add are high score function, and that's what big it. So if our layer preferences that get integers get integer, they were getting our score and then you're gonna put a comma zero. Seeing the default value for our score will be zero. If our sport is greater than our player practices for your preferences dot get integers getting are in danger and that will be our high score in comma zero are high school by default to be zero. If that is the truth, I mean, this is the true. So if I get into this sport is greater than our high sport, We're going to say the layer you have preferences that set into J and we are setting are high score ice for to be our layer preferences dot Get into jerk and we'll get our score. So what is this? Basically, we are checking if our Blair breakfast is not get interest port, meaning our score. If it's greater than our high score that we are going to say our high sport is equal to score and that is that. And I'm gonna leave the curly brackets because you will have only one life for this. If statement and curly records are just taking out some space. So right now, how can we best this well, we contest this different remember in our game controller, he reset, I add high score text and now we will add it by say, hi high score, tex dot Tax equals do are s So it is on a number so high sport equals two player preferences that get integer We are getting our high sports heist for make sure not misspell anything dot to streak. So, like this we are getting our ice sport. But if I put this to be delayed IDs if I leave this, it will not work because we cannot put tax to be uninterested. So we have had thought to strength, so that will actually work right now. And we have to call out that in our give Lee controllers. So we're going to say game controller God instance dot What is that? Next level panel curly brackets and send my call if you remembered right and right before I am not ready. Go. But before, like, few minutes, I have said you cannot call a function if it's not public. So just put our public public boy next level panel to be public and Walla We have no problems right now. I'm gonna finish this as quickly as I can. So to do that, I'm gonna go to the left, throw down our balls. Yeah, It's like this play a bit of our amazing game. Come on. Like that when I went off past the myth fast. We have to meet our bungalow fast. Get. I'm gonna pauses. Where is our ball with? Here. Continue. Come on. It right here. Like that in there and here. One more. Yeah. As you will not high score. Do 50 Right now. I'm gonna play once more. But how? He rented this. Well, basically, right now I'm gonna duplicate one of these. I'm going to be two of them. And when I played the game once again and we destroyed them all with our ball, you'll see that we will have our score hiding height. Not hiding, but our school will go higher. So, like this? Come on, iss he There we go. That's a lot faster. I mean, you could skip this part if you do not like it or something, but it's okay. Come on. I mean, I'm doing this as fast as I can. So close. I mr, by not knowing where direction was going. Exit right Now we have to 700 which means our score has done up. And right now, I'm not gonna do this no more. I mean, you could do it by ourselves. I mean, you could beat out the level and you will see that are high score will remain the same. Saying that are high score is to kind of 2700 which is busy right now. And I'm going to do this. So I have to show you mean because if I did not show you now, you can blame how it's not working. Please. What's going? Okay, you have not. You did not put it so me. That means that it not work for you and that kind of comments which are not released. Head swing. Come on, Doing this work. Flip as I can come on like this. This is the formula for the fastest. How fast Finish our game. And you see, right now we have scored 2 50 and are high score says a few 170. Even though we have closed our closed out our game and come back to it. So, guys, that would be entirely implement our high score. I'm not here. And until next time I see you guys in the next video. Of course, because it's until next time you get my point. Just getting goodbye, heist. 11. Life Counter: What's up, guys? I'm are here. And today we are moving on our gameplay controller. So you know the jail. Go and open our nameplate controller up so would not waste any more time Once we are inside arguably controller school down a bit and curable Add are void life counting like this void love life counter and we are gonna call it inside our brain function. So I do not forget way their arms life can't kids And my call now inside off our love kind of first thing that I'm gonna do is we're gonna check it our ball ball Don't transfer that position. That why is less than minus And that's had some loads. Public load wide found coming like this. It's last them. Why bound? We're gonna check what is the bond later? Then we're gonna say die equal to truth equals true. Then we're gonna get our ball dot get component. And we're getting our rigid body to deep get Bridget but d Kobe apparatuses and then got lost. E equals two new factor new but equals directive to 20.0, meaning that our ball will be put in place. It will not move because we have died, then we need to check if our life, if our life is equal to If our life equals 20 we have died, so died else. If our life's life is greater than zero, we are just going to say ball dot Can can That's a problem and go through ball script. That is to be public needing as public, we would say ball that can equals falls this and then ball the shoot. It was false. Meaning that will put our ball back at our paddle. I mean, at our pal, I'm gonna add a bracket. So we have no problems occurring. What else? If its place And here I was common diet. Then we are doing check here. If our die is true, we are gonna say before that is true. We're gonna see if our time dot time scale equals two running it are playing. You're gonna see a life life minus minus. So we're checking If we are playing well, I'm gonna take out our life. I'm going to say die it false. So like that and then last but not least, is going to say game controller. That instance the life score text equals to life. The active streak So was a problem. Not live. We have life. Your life to shrink. Did not how dot Tax So what takes that text equals tow line that to streak and this die function. So I'm incompetence real quick and put it down here. This guy thing is actually at a game controller. And to add it on, we have two options. One is to have our game controller find our game controller Soak. That's a private game controller game controller like this game controller and then our start function. So this awake because they are searching for the object. I like it more in the way I explained in previous video. What is the difference between a weight on wake and start function to game controller equals two game object that find anywhere city for our game controller like this that get component and we're getting are being controller. Script in control escaped. So I'm gonna like this and then go to game controller put down are void died to be public to this. And where is the gameplay patroller and she really miss say, where is game controller that what's called died So we call out our white function because we had died. So now let's go here and check where the bound is at. So if our ball goes out of the screens, we will check. Where is that? Actually, so that is some around negative one is. So where is our game? Click for negative 2 25 Warning like this for that too. If our ball goes beyond that, we will Dia, our player will have to restart. So let's just out here. We have lives. We should have two lives right now. I have zero lives. What? What just happened? I mean, game over is working that you think. But if our life is equal to K, I think said bless their minds. Yup. That extrude life for di ***. Everything seems to be fine. Okay, let me tell this one more time. What's the deal? Okay, okay. I think you know no gambling fellow. Bite with minus 11 See here. Maybe five. That when yes should be. That should not be a problem. So let me tell you one more time, if it's about that and that is the problem, not one. But that is actually a problem. If I put here, I've got 20. It's not working. But if I put why Pound bomb, We have a problem. Like for a while now. Here. I'm gonna say eat. Astute. Negative, I think to let me test is Oh, I know. I know, I know, I know, I know, I know. My bad. So here we have put down a minus. Where is it? Minus of minus and minus breeds, plus and plus is not a good thing. So have you have to believe the minus here? And then we should have a problem just like that. But right now are my score is not changing. So let's say if we are playing dies, mambo don't go out in a way that okay, we have one. But that is where we die, not before. But when we die. So this take it out off our ball positions have taken out and put it right below it. Or actually, deeply, even in first place to put it in first place. So right now our life should start counting from beginning. So from now we'll have to All right. Yeah. Right. So right now let's take our ball and die a few times so we can actually die for sure. And one more time you have to realize arcade game or high score. Everything is working. So as for our high score are just gonna copy this thing. No, we're just gonna not copy this thing, but set here. Confidence stings of player. Perfect is that's a high score to be score. Go to game with filler and wherever we have common the high score. We're gonna pass this over. So like this, like this and that will be it. Last time testing out our game gave over. This time I've tested to go home. It's working now. I have to test if when we die do we restart our level? Come on. And one more time Died high score. Still a problem? Never mind, I think. Is that real soon? Yeah, but are start is working with the ah one problem that cannot move right. Let me check What's the deal so impossibly again? Find times 8 to 1 like this when we die. Timescale? Yep. What's the problem? Purpose That said Interests court. No, no, no. I get one from once. One more mistakes in copying this thing. Not nothing but this thing. Next our panel and put its year impose. So yeah, we have to change our high score text. We do not have to put our high sport. We already have the high score, but high school text is needed. Never mind. Sorry about that. Let's move on. Everybody makes mistakes. Yeah, that's one. Do our lives to realize high score working when restarts again. We have the same problem And that is where we restart our time That time Skill does not change Right now I'm gonna put inside of our gameplay Mm No, I couldn't game with solar in game because people have our update function and gonna check here brained time the time scale like this. So let's start up our game and problems. I'm gonna die quickly. So for them balls, take our balls. Put a day of continue gumballs Dio continue. They evolved Their continue. So right now it zero. But when a restart its one. Yeah. Now now it's working. Please tell me what's a What was the problem? I did not know what? Why get I'm not even gonna bother. I'm gonna tested one more time so this is not like or something. Maybe this is because of the costing. So let's test it one more time. Not there. Go good. No. Uh, okay, I would actually zero when I restart, it's still zero. But a second ago, it was one. A second ago. Never mind. Never mind. I'm just gonna say inside our is it inside of are a function like we have put our for set into just court to be zero I'm gonna hear, Say, time, dark time scale equals to one. My goodness, I'm gonna die the proper way. So we did not have the same buckets right now. It worked for a second. Then it did not know what was what was the deal with that. But I'm not even gonna ask. And you're right now is working right now it's everything is settled. So guys that will be it for are deeply controller. I'm are here and I see you guys in the next video and you One thing I productive talk about because right now we have great this and it's working is that we have two types off calling out our game patroller function from another script. So one is creating public static Game patrol, for instance, which is the most usual way I do it. So this is the way I do most of the times. But there is another one which is private game controller in game controller and find the script. Once you do that, you can then type in here game controller, Really game Children that die. So I just want to show you the two types of the two ways you can do that. Maybe there are even more. But this is I mean, these are the most used way in the script. Nothing's quick birth immunity that I know, of course. So right now I'm gonna delete everything from here and change our game Died two game controller dot instance died gives everything is taped up like that. So why would be change Onley for the diet script gets right now? It is working even like this. So, guys, Yet that is what I want to talk about. So you do not get confused or something like that. I just want to clear things up. So, guys, I'm here And until next time goodbye 12. Chaning Levels: What's up? Guys are here and today I'm back with another We dio in this one we're looking at. How are we gonna change from our level one to level 234567 on? So want the panic on how many levels you have? Well, basically, it's really simple. We will go to seems farmers would say it's fuller. Great separate folder called Is Level Folder folder. Oh, that just like that. And here we are gonna add some folders, so create a new scene. Save it, and we will save it s level one go scenes. And he said, inside our run Fuller go back to game play and real grief had almost everything we have. So here create a separate fuller call this level 3/5 game objects again Objects four levels . So for love, though three steps game objects didn't objects for level steps. And that will be I gameplay controller, our game controller uh, backgrounds. What's that gay canvas at? Cams do But I'm going to change the name from chemists to game. They you are this so we know what it is And paddle and ball create a separate fuller for a vessel, paddle and ball. A side of our fell in volume at our balls are so right now Back to our little polar and open up our little one. Save everything. And here, open up. RP Febreze, Where is it? Break prefect, I'll break. But game objects at background gave the you I game patrol or gameplay controller and are ball paddle. And here we will have armed one because this is one fuller. Hello. But now if I start again, you will see one bug or a problem. And that is our buttons are not working. Show you exist. They're not working. And that is because whenever we create our campus, we create our you I haven't system. And now when we do not have our Evan system with this where we do not have our Evan system are buttons are not going to work. Really simple, greatest simple. So Oh, okay. Now, once again, here will have to add everything. So pause this ball game or text. Or is it Les Button boss? But where is it? Pause button And so on. Life's four high score Where that he rehabs high sport X Where is our bacteria life scored text and our sport test. So then he damn down applied And at are pause battles. Do not forget that fly. And now when you start our game, our buttons shipboard and everything else in the whole you, I think, should work. It's not it's not. Why. Why? Why? What? What, what? What what? What? Going to pause. I cannot move. I go back here, something is missing. So something from ball is missing and I will see What is that long both against start points to start going position. I mean, just like that. Done. Blood paddle. Is there something missing the ball in play? Being patroller. Simply keep background. Everything else is fine. It's fine now. What's this? You play a sport text for a Cherian. Fix that someone clear this all with all and check it one more time. You know what? That 25. But our mind on our pause button is not working. Gameplay is are possible, but it's not. So this is counting our bricks. Mind what? Let me go back. Our scenes in placing haven't system into you, I ignore everything else is the same. So here it's working, all right. It's working. But if outside of our level holder came before past panel, this is boss panel. Open up Should work. Everything is same. Same things and stuff. You don't lie. Apply just won't be applied because there are still black. Know why exceed our button is not or king even though we have having system where? Our canvas child. Afghanis, everything's attach. Oh, I forgot. You have to go to pause. So pause. You see, adhere armories, Game controller and put here getting told, boss, just like that. And now it should work on what is working and it is working. Yeah, so you had that will be in that. Well, how will change from level to level now we'll have to add one here. We can't believe the gameplay where I'm gonna leave it now. Believed now again. New level And these things up at great new Scene one Control plus end while using our fall safe. Not using Save Sean's love Fuller to on a prefab skin or repressed background game controller Gameplay game trouble. Give the controller, uh, balls had those and yeah, starting from or ball at start points Stars Boyd, the our game controller. We're gonna add already Life scored text sport text is our high score has high sport text boss text Blais body home button What's that? How you have to add it. So you have forgot for our home and for our possibilities are because we have to add on click So we have a lot of click and attach our game controller As for our boss will be pause Function as for our home is will be home function or manual. How is it gold and last but not least at are you are you have a system where and everything is I mean boss but he have to be has to be added Hey are prospect so everything is good when it comes to you I accept have consistently done that Level two moving on I believe that's for you guys who create another scene which is called level two. I was scholar three at all these and add three level now go to scripts Where is it? Our controller scripts and open up idea controller inside our game controller, As you can remember here we have If we level color, equal stool will go back and level Well we're not gonna do, Dad. We're gonna do something else. Would you see me lift a dad? But a better option. But do that have to reach the valuables from gameplay controller? So we'll add our public static gameplay controller. That will called instance. Then you'll have Where is it? Are? Well, Blake recount Ursa level counter will be deleted. Not needed. I title leading but way want so instance it was to this. Don't forget that that nothing will work and leave this here. And so this will be for the game place. We have added public static game controller instance in place. Literally distance. We have put instance a bit this and we have changed our public into Brick countered from private public. Now go back to our game from filler. And here we're going to check if our get CPR. Seen managers if seem injured dot Get active sand, then searching for dot name equals stupid level one, even the scene usually in level one and on our break counters game slave. You thought that incident of brick counter equals 20 So I'm not entirely sure if dice 0.0 is necessary or not. I'm gonna comment that out and added late aren't just just to check if it seemed suggested Check if our level gets his name is equal to women. See, seen managers seeing manager dot loads heat and you're loading Aren't level to see and you will do the same thing for the tarts. Copy this, basic over that, if our level seems to have been changed from that will seem to three. And yeah, but the argument that you are both in game play for that instance off ball for definitely needed. I thought to put everything on to be Where is it? Where is our ball? We put our ball to be a rigid body zero elastic, but I think it's not needed if it is just gonna add it. So right now I'm gonna play this. But first you have to add in the build settings are undo. What's this? Yeah, that is Rick Counter. No. Does not mean that not even remember, where have I put it? May be that I was testing something. Okay, go to build settings. Open up. Are you well to like this? And add hoping scene now, one thing I almost forgot. So I'm gonna do that right now is go to scenes me menu. And for our placing, we need to change his army. Many controller open that up. And from here, we're not holding game place him, but they are loading. Are level one like that? Now back to unity. Clear this. These are scenes. Come on, come on. Just getting says well, full of one people to help. Now, I'm gonna skip this true until we average the end so I can show you what is up. So I said I'm gonna skip the plate through, but I have forgot here that we have to call out. Are is it our next level town? I have finished the level there but not think showed up. So we have to call our next bell, and we can do from here or dear. I mean, it's actually it actually does not even matter what. I'm gonna do it from here because it's easier to drag this only then everything else. So if our gameplay, if our break counter equals 20 they're gonna call our next king controller. Thought instance the next level town. If our break it kind of is zero, we can call our our next level. So now hungering They eso you guys Not what? Complain this game, player, maybe a board of something. I'm gonna skip it through. So see you at the end. Right now, we're at the end of his presidency. I died two times and our scores to 50. So now when I please click play, you should have go to sea level to And there we go. But right now is when I start all over again, we have our score zero and that is a problem. Can we want to continue from 2000 and 500? Did you then go back to scripts here in our game? Patroller? I think now I am gameplay controllers is a huge have labour practices. Dustin Interest Court to be zero. Now I'm going to leave that Cut it. I mean, go to game controller in a way. Function check. So if are seen, manager dot Get active scene, then are built in dealing, but names equal stoop level, level one. Then I'm gonna call out that. So if we are at the level one, the argument called out our player preferences not self interest for to be zero. Right now, when we change from zero, do for level 120 with a little one. To what? Stay for it. Live alone from level two fours or we were not going to reset our score. Meaning that we can always change our high spur. So, yeah, that is how we will go from level one to level two, Level 34 or I do not know how many you create. That's up to you and your imagination. As I was saying that hoping it for this radio I'm out here and I will see you guys in the next one. 13. Setting Up Power-Ups: Welcome back. Guys are here and they are going great. Our power ups for our break breaker to D. So let's get right into it. The first thing is going to sprites spry. It's art and he will see powerboats. We have big bucks pants, fast button laser, multiple balls called sew buttons like slide and shrink. So we're not going to use any anybody. Very luxurious. Every everything. I think a lot of years multiple balls and not going to use cop. So I believe that on you, everything else will be covered. But in this video, we'll start off by a bit. So first thing we're gonna add one. We just are big ball expand and it to you eyes sorting layer, power up, former up like this are up and added live poverty. It's kind of too big to be a eight. Still, they got six that 6 40 Yeah. So I'm living at points five and going supplied for the week and height called is all expand. Barbara ups expanded. I spent. Yeah, I've done it directly. Close it up so we can add our circle Collider de radius. It's a bit off, so I'm gonna put it down and you go to the assets. Pre fabs create a separate fuller. All these power off brief EBS and they'll sort are are upset bullets, man, it's done. Oh, forgot to pay to be a trigger. So we didn't want to be a trigger came down plot and we can't deleted. I think I did not have talked about this, but we used prefects so we can store game up. Oh, yeah, I did so but still I'm gonna repeat it. We have to know we have people are down prefab, so we can spot them whenever we born. Because if I put here again is our big box pan it will not have any of the components that need so there. Therefore, we have to brief have them so we can use it whenever we want. So as he of sorting layer cover up and circle lighter with down and it's not That's in the same for laser. Oh, but I forgot spinning 515 just like that Laser is our laser. Certainly for up. Come back here. Laser. Were you add you circle lighter. 0.17 Where is on? Lasers costs low because you will slow down our ball over 55 Surgical. Either 0.1. And I will have our slide expand and slide shrieks. Best drink boat or, uh, 0.5 point five. So we'll either zero point court set once everything is not go to prefab and prefab them also for represent slide shrink. Expand, Father. Slow button, laser over. Fast button wants That is done. We are gonna create art, is it? There is our scripts. And here we're gonna create our power ob script. So polar over up script, script, and then create a C sharp scream. Did you call forward up and opened that? So inside our power up, we are gonna believe the comments. And now it's up to you to choose what you want, What you want to do. First, we're gonna have you destroy shores. We're going to destroy our game object. Let's say after six seconds. Now what's the deal? Basically will respond are part up game object we do not want do not wanted there to be for our because you have too many power ups on the same, it can cost us performance. I mean, this a small game for up some other big and so one. So in this case it would not matter. But I want to teach you guys to always keep that month, because if you left out some game objects that are not necessary to be there, it can cost awesome performance, and it's unnecessary. It's unnecessary to have a power up that you will never catch and will never use. Now inside are they function, function. We are gonna have two options so you can have movement where so moving, like chanson dot position equals to you back to do. And then she hasn't position X and for the white transformed that position that y plus feet . So that's one way someone that here public slow speed. That's one way or another which will be add our balls and for our where is it are come for upstate at for up script. But power of three steps add them on with a rigid body to D and have them gravity have them pulled by a gravity by gravity and the splitting of Eric England drag. So it's up to you are gonna show you both ways. It's pretty simple. Does not take a lot of time, and it's really cool to know what can you do right now? Everything is done. Have just are part of scripts over up, Let's say speed 0.1 I mean, we can test it on later, but that's be it for now. And I'm gonna take them all. And they were gonna finished our projects. Are we? Do, I mean so intact at tag and I'll have some tense. When will be saliva expand under one will be slide. Shrink where there are evolved. Expand. Spahn, expand! They have our ball speeds up our balls slow down, and then we will have our laser and I think that will be It's that will be it. So once more, forget tightening. Once you go pre fabs for up Daleks, Bell, expand with books. Fan the power fast. I'm gonna call it fall Speed up so I can take the same way balls balls them so we can know what it's up on, What we use, What for? So down slight expand Where is it? And slide shrink just like that. So, guys, that's a bit is for setting up our Perhaps later on we are gonna tow them to be spon after we destroy some of our what's called bricks. As I said, this will be it for this radio until next video. Next time video. How we want to call it. See you go See you. I'm going to say goodbye. 14. Finishing Power-Ups: So in our previous video, we have set up our cover ups, and right now we are gonna add them to our ball, open up our ball script and here at our public, the object of an array that you call over up sit for ups and then not so who notes that. But I actually did not the Ito saying that, Amar. But right now I did so it doesn't count. Never mind. Never mind so good. Teach, As you can see here, we have put up our power up and power up comments. So let's leave that and add are up. So we're gonna check if our random dot value for random doctor value is less than point, meaning that we have 70 or 30% so sure of chance off adding are no. Our cover's here, I'm going to say, and random cover up equals two random dot range from zero to over. Upstart linked. What's this? What is this? I mean, basically, we're creating an indigent that will tell us a random dot range between minimal and maximum number saying from zero to poverty. For now, we have somewhat off six I being perhaps or seven never mind. We can even put that here. I mean, you could put here 76 that good work. But let's say you add more problems. Super game. Then you'll have to go back to the script changes from 17 89 to home in your ad it and then continue with the script like this, you can add, remove, do with everyone. But by saying proverbs, that plane this group weren't remained the same. Then they were going to say instead Shayt and were instead changing our power ups at our random power. So we are getting random cover up its target dot Transform that position at what? During your work during and identity. So this is how arguments pontiffs. I'm gonna confidence and put it down here. Now we'll have to go to our ball and at all of these game objects like brief, perhaps for our cover ups. And now one thing I will share you is lock our ball down so you can see here this padlock above Inspector Tab, lock it down, go to assets pre fabs for our prefects and tag them all. Why don't you select them all but even breast control plus a There's like all hold on to him and drag them right above here. It says for ups. And here we go. We have added six element with one drag. If we weren't to do this, let's see, we have seven. Will have to go and add one by one, which is no fun. So like that and he done applies. We have applied them, and right now we can test it. So what I'm waiting for. So let's test e r. Perhaps chemin coming down. So yep, they are. But they're going up the help. So go pack to them and check ours. So, being unloved, it are speak not one but minus. And when it's kind of too fast someone season 0.7 like this and I will have to do that for all of them. Negative 0.7 Negative. Because we have to put it to go down, not up. And let's just out this fastball, sir. Come on, come on. And this is kind of too fast. Even so, I'm gonna put it to be less C four. Worried I do this or you can leave it, but foot speed to be zero or mine and we can hear at live it 10 port movement. We can add rigid body. And let's check it out How it is when you add rigid body. I mean, I kind of more like it with the script scripted motion. You could see why it's take it stayed there exit. This is how would fall it would fall. But is it to you right now? We have some problems and I'm going back. Three. Babs, Our pre Febreze. There are three during guests right now. Maybe do they were not all the triggers, so that was a problem. But you saw how it goes with rigid body. I'm not gonna use it, so we remove it and I'm gonna leave our script out. So it's like this script. So there are negative. 0.4 will be the speed off our perps right now. We'll have go back to our Where is it? Paddle. We not year assets Scripts that where is a paddle? And open up here. We'll have to go down all the way. And you were gonna create Are void on streaker. Enter too deep. Go live there! Do De named star like this and we are gonna check if our target that tag equals. Let's a slight expanse, But extent, we're gonna destroy our target dot game object. Ancol outs Our script. Copy this basic over. So I shrink. Ring age. Age are I think this drink God is down based over, you'll have our ball takes. Then copy that. Go down, shrink this. Go down. Well, speed up, speed up And last, but not please a laser. So you laser. Now I'm gonna do this slide, expand and drink. And for that we will have our eye in numerator that you call expand ball expensive. Expand on Lee because box is loaded and he would call out to yield. Ripped done. You wait for seconds and I am going to create a timer every time it will be the same. So you know, Missy, private timer equals let's say effect of the off the what's script will be so eight, eight seconds And we're going to wait here for the climate. We can change it after we're not satisfied. And here I'm going to say, uh, come on, ladies active three was transformed that position chesting about local scandal police. Local scale equals two new Acto do, which will be when we expanded. Want expand on the X? We're going to say what is are currently so currently we have our 0.4 expand. We will have Europe with its five. But your case five from 4 to 5. But it's six living from zero point for two 0.6 and transformed up local scale. That why will remain the same After some time, we're gonna copy this. Copy it. And after After the timer. Eight seconds to be are going back to normal. Now I'm gonna copy this. Did it down and call his three rink. So 0.4 is currently someone sees your 0.3 25 for when you shrink it. So if you check How would that look? Like 25? Come on, You deal? Would it up? Compile it. They thought Hang on. That is pretty small, So yeah, live it 25 with me, Shrink. Then I will test this now. So stocks, four teams have you start over Teen Extend and he will have our start over TV shrink. I was gonna add here. Where is it? Are the from on screen. But it is that you have I had so pallets pant, pant string. So I know. What am I doing spent and so fell shriek like this. So right now we go to unity and try to get one of these So we could test if our power ups are working. Come on. So it's not speed. We need shrink or expand. And we're going up, Frank. And to see we have shrink our paddle and after eight seconds for some time that you have put in we are going back right now. Our laser, These are brief EPPS. Laser is untaxed. I forgot to tell our laser you that so shrink and expand is working. That's move on with our ball. So we're gonna use the same have principles so called for this. Put it down. He called his ball spring as our vault Me, we are going to say same thing that's rain. But it's all the same thing so transformed that locals he'll be the transform. It will be evolved. The local scale fast from the local scale equals two new and for our ball would have shrieked have only expands. As for our ball. We're gonna put it to be 0.55 and here, ball transfer about little skeet I after some time all the transfer of a pope. Skill new. And what is the people are ball and 0.3 zero point tweets. But in this case will have to change boat off our watt and are Axel Bob. Decks will be changed. If you only change access to Bill, it will be looking like this zero point slide, your 0.5 and you, if they did not make it to be white looks something like this, which is pretty funny. But when you put it 0.5 on the why it looks something like this, which is pretty cool. So that is for box path now. I'm gonna leave it later on for our ball speed up, so I will attest it one more time trying to get our ball spans to see if it's working. Oh, all of the God and succeed. What? We did not have increased our ball and check. Okay, We did not have call its start Cortines, and we'll call out our ball expand. And one thing I know this is that I have a lead ball screen because you'll not think our ball and I don t I think now we did not put text. We didn't get on tags, but not in our spirit. So right now I have an idea or not waiting for it to pop out because we have already tested that it's parting out. I'm doing added here and gonna test it out right away. So to you right now and that it are about increases you just like that. So it is working. So, guys, that will be it for these. Perhaps have a look for you in the next video. We're continued, but we'll continue beginning with where where we will continue adding more interesting power ups. So that's the it. And until next time or until the next video Goodbye. 15. Laser Power-Up: So I'm back with another with Theo in our brick breaker to D. So let's move on. As you know, we have not finished all of our power up. So go to breathe at the group scripts, Pavel scripts and open up our panel script. Once they're here, I'm going to say I'm Omar, and I will be teaching you guys how to speak up our ball and slow it down. So one thing I noticed here, sir, by that I think I was No, I have noticed. Here is Do we have not put here evolved? Slow. Slow down. This as for that are gonna add our enumerators concocted this vaults be and then we have to change our balls. Got get component. We're getting our ball script that comes to constant speed. Evil students 6.5. So we're gonna put it above. So I think our ball is it. Actually, it's a game object toe for our ball within a set our get complainant so we can get our script and we're gonna change our constant speed to from provide to 6.5. Then after some time, I'm going to see a year time and I believe it. And I'm after some time I'm gonna put it down to be five as waas normals like this that I'm gonna copy this ball speed. Just be done with slow down like this. Anyway, we're gonna I'm gonna slow down, or that's a 3.5 3.5 should look fine. And after some time, we bring back our speak. So that's good assets brief, perhaps for a brief eps. And add pre fabs for a game as we did for our ball expense. So we can easy has it out. Slowdowns up. And before I forgot, he will call out artscape to start cover team balls up. And here are start 14 ball. Slow down start. And then we are gonna tested. Yeah, I forgot to add something added. Right now, Barcelo down. Come on and succeed are about Is moving slower than it was before. Or am I tripping? So we're gonna see it had after some seconds and yet it's here right now. It has been up. Okay, I'm pause it here. Our first continue to run out. Eggs are bulb. It is moving faster than it was before. Says he's e. R. Script is working right now. I'm gonna go one more time over it. So we're getting our ballgame object getting its component and changing its contents. Constant speak. What did I do? Jenny? It's constant speed for the speed up. We are adding it up or slow down. Where? Over in lower ing it down. Exactly. Right here. We have said it that our body equals to constant speed A lot. My body that lost it dot normalized meaning that are constant speed is the key off changing for our speed. So yeah, that will be it. And now it comes up our power laser, which is the best power up in our game. I know you're eager through learn how to do it. So let's get started. The first thing we'll have to go sprites our team, the team, but textures and add these yellow thing for it. We have to put it to bed. Former up as scale for wild B 0.3 and knife on the wall. And we're gonna call this laser on laser Will have boss go, I there. I mean, check Bocklet, but this Boston, whether it's kind of too big for its going to scale it down like this. Zoom in so I can get the perfect measures. And there we go. And it's going to be a trigger. And it will have our box go boxer, but rigid body so we can detect collision between our what's called between our bricks and our laser and put it body time to be cinematic. So we do not have because we did not have because we're not going to move with our rigid body. But actually, we're going to move with our that void. We are transferred about position. I go to script over up scripts, and here we're gonna add R C sharp. Screw with that, we're gonna call laser and now add laser to the laser. This mom, where is musket later? Where his mosque with laser at. Come on, laser like this. Once you've done that, open off our laser script. Then we go back in our paddle script and changed up our laser to laser for up. I think it was Yep. And then we can start scripting our lasers. So to do that, we will need are public game off tactical game of laser laser and our public transform position one and position to for our lasers. Now go back to unity. So laser power up. Let me check. Well, yeah, I did correctly, but right now, inside of our unit game engine, we are gonna ads of positions in our panel. So great an empty game object inside of our paddle college laser pause or positions and then inside of that ad one duplicate and name it to provisional with position one and position to or the position one. I'm gonna dagget with Blue Icon and put it to be somewhere around negative 1.2. And while the 0.5 now carpet this car, typically you only click on his gear icon copy components and pays it over our tubes. Best based component values and just change it to be a positive site. And tag. Would I come click here on a blind paddle and now we will have to end its position. One does she do, and we will have at our laser position. But to do that, we'll have to create a brief about of it. And right now we can add our laser to our laser, our battle laser, a laser, But laser our pal, and that he once again apply. So we apply all these, go back to script, and now we're gonna create are in the Morita's, uh, in numerator laser shooting where I've just been curly brackets and I can hear yield return Read that turned new Wait for four seconds seconds and then 0.5 after four seconds. Now first did not copy this. I'm gonna show you a bad example how to do this So bad example. But it's really how hard court things. I mean, it will work, but we'll hard coatings. But so do not watch this example, but one that is coming up. So I'm gonna show you what's the difference? So, for this fund will say, Let's say in stand Shayt well in San shit. Our laser game object at our position one dot position and then Or bullying What? Turning down? I then. So this will be for the irritation. Now. Got the disc up it and basic over and put in here. Position to now. I will call all of this pace over. Pissed over there, over visit over. And so one. So right now. Well, in Stan, shape our lasers so cool since it to lasers at different positions. So have our laser here in here. Start starting, shoot up at the same time. Then I always for some time, depending on how much you want to wait. And I'm gonna here at laser timers. Where is it? Thought laser timer. But that actually will be not a ninja, Drew, but I'm gonna leave it as flowed. Flowed, Pride float timer. They are laser laser timer, which will be once he's opened five. You can change that. Obviously not like it. So after all of these are gonna clicking here laser timer blackness. As I was saying, hero in Stan Shade, laser by laser by how many times would put it? And right now I'm going to start the game and you will see that this will actually work. Let me check. Um, we have no laces. Okay. I forgot at our public laser. Now let's start and you will see that the lasers will work by one problem down. What? Okay, okay. I know I forgot to start the authority in the laser. So when you want the function to be on, you'll start. According so, Sarko routine what's called ways of shooting like this. And actually, I'm gonna put it to be above I've destroyed. So we're gonna first start shooting, and then we're gonna destroy our game objects. So keep that in mind, I'm gonna change that broke break. And I did like no again. So, like this and with change for everything. So like this. So we have no errors, just in case we did not have for now, just in case we did not want to destroy game object and then not start authority. As I was saying, No. When we start our Hortencia ways, Er's are working and there we have no problem. But there is a thing that we can actually all we can actually do all of these in one line on how to do that. Well, basically everything. Just leave these three. And here, we're gonna add, are four loop. So four open our bracket integer I equals 20 If I is a less than some length Renck I plus plus. So this thing we are going to choose and this length means how many times do we want to shoot? So let's take six times. So if r is greater than six. It's not common. But, Sam, my column with a common like this. If isa greater than six, we're gonna add one more I and then we're gonna we're gonna put these blocks of code on. So what am I saying? I'm gonna repeat it one more time before Look, we are first Grady interject I which actually zoo If zero is last six I plus plus and you around the coat. So first, run the coat and then add plus plus yeah or not, it's vice versa. First, when you put I plus plus first plus plus it then run the code. But if you put it to be like loss plus and then I it will be the wife's first meeting that first run the code will first be around the code, then add I plus plus never mind moving on. As I was saying, if our zero is less than six will add one more adaptable intentions are coat. Then it will be here one. Then if one is less a single run are coated in two, then three, then four. They're five and six and when it comes to sex will no longer will no longer have our code loaded or the block. Of course. Now is it eat now it'll work. But go have Onley used one line for it, which is pretty amazing as you saw before. We have to use six times the same code and the thing is all of the same. So there is no need to use it to heart broke things like really before. Now here you can put here some public indigent and test things out. Same goes for the laser timer. So everything else is up to you now. We will have to add our spore, Remy, destroy our bricks. I mean, we'll have to destroy the brakes and then at our score with our laser To do that, we'll have our void on trigger and D That will be our collider. Either to be with our target's name, the target or whatever you like. I usually do as target. And now we're checking if our target dark tag equals toe brick brick or so putting up these straight bars means or our target doc tag equals to break. So break you. If that's true, we are gonna say destroy target dot game object and this for our game. Object. But before you, Dad, we will say Blais of preferences Opilio press that set into your and we're getting our score. Or then he will save player crafts dot Get into your We're getting our score. I lost 100 so it's basically the same thing with it as within our ball and check. Is it right here? But we did not have this war indigent inside our script because every time we hit a break, we will destroy the laser score and it will restart over and over, meaning that we will get only 100. No matter how much we hit or how much we break destroy with our laser. I think you get that guy's so right now If I were to add the where is the best thing here, so score. Then we will have the problem that our score will be constantly at 100 whenever we hated with our laser because the laser script will be destroyed as between gave object. Now we are gonna add Here is our ball We're gonna add the same thing, so I mean we can cannot It's up to use if you wanted to copy this thing. You wanted to get a what? What are these called? The cover ups with our laser. You copy? Listing up. Put it down here. You will have to add the power ups. We are done that so I mean, it's not necessary because we're getting score. But if you would like you, you will know what to do. So yeah, I was there, left to, but testings out to see if everything is working correctly. Starving, getting a laser. And we're getting our score as Billy before. So yeah, one world and we can on Right All we get, We already got it. And as it gets here right now, we have a problem. These two sports are mixing up with each other. Says it's here right now. When I hit on Lee with laser and we checked What? I had a real laser. Let's say you have 1 31 61 92,020 But when I hit it with a ball, we we go or with 100 he thinks that you're going back to our ball and we will just copied it. Lays of things just this thing will be copied to death. So where is it? So go Just did this. And our score thing will not be needed no more. Come on. Where is it? Spreading in? Scores of monthly needed. So let me test it one more time. Hopes the last four. He had an arrow at me. Check What is all about? Come on. You to scroll down, School down. Squirrel cages passed over here given like this and now we can start. So right now we should have no problems. Meaning that our score will remain the same. No matter be vacated with our ball or with our razor. Since you consumed right now with test it one more time and we have to restart our score all over again. But that that will do later. Right now we're getting our scores for Sports Force four. But when I get there with ball, yeah, we are getting just on it now. The restart, our score. We'll have I think we already have. Here is our main menu controller games. The controller. No game. Yeah, You have a cute you far level may have seen his level one. Where is our level one? So this is a game place team. This is not a level one. So let me go back. But is our seas well full? Lower one. We should restart our score. Meaning we will start from zero. My correct. Yep. Um, come on. Will I get the laser one? I am. So everything is working fine. Yes. So, guys, that little bit it for this we go. I'm not here and I will see you guys in the next one. 16. Adding Sound Effects: Welcome back, guys. I'm out here and day We are adding some of our sound effect that we have here it out. You. So we have our beam. We're going to use that when we hit one of these bricks have lost and we have our pad where he are better. So yeah, that will be it. Let's get right into it by opening up our balls script. Once we are inside of our ball, script will go on at our public. I would deal clip and it will have our hit a brick and it will have are hit paddle clip like this. Now to add one, these will have to go on to break. We have your sound and will save our deal Clip Not all declared, but our dear stores dot Blake Cliff at points bring our cliff at point. What click hit break clip at transformed our position So a simple as that will add our sounds confidence and pasted over here Now I made a little mistake So will not have here. Peddle Cliff, We will have that inside of our pedal. Then we go back Unity scripts where our pal scripts and open up our panel Script one Unity . Are you here? View it. OK, Open up. Bala script. Once we are inside of our palace Cooper, we are going to do the same thing. So you will see public all of the clip and we'll have our laser shoot and we'll have our of hit glib like this or both. Only bulk with Paul quit. I'll go on, Go on school down where we add on collision. So this is where we hit on Collision will have our sound and that's be same as we did before. So how did your source meaning that we're getting from our your source than dot They're playing our clip at some point, so you can change that, but it will not have affected because we are in the two D game. And where, when, when it's about positions in our clip, that means that we are using three D, meaning that well, let's say we are three game. We're somewhere around here and our ball is way up here. When it's hits, I mean, our ball hits the ball. We want to hear it about I want to hear it loud, but that's a way appear won't hear it. Not Loader Bird. What's opposite of loud? Necessary? But you get my point. So that is happening. Onley in three D In Judy we do not have that. So we're playing our butt head bolted. Both clip my boat ball clip at, transferred our positions, so just put in transformed Bad position. Now school down When? Till we get here, he'll have. Here are audio audio source dot play Cliff at point and your plane are where the laser flip , as a short clip had transferred about position. And no, we will not play are I would your sort of two times because it's unnecessary. Now let's start up our game and test things out. But we have first at these clips to go the battle because we have their two clips. So assets. I'll dio Ana for the laser funeral seal ways. That shirt and for the Baltic is we'll be. This panel sounds He had done a flawed and weaken onto our ball. And you were any our resident beep. I think it was getting close. B. Right now all there is to is to test things out. Meaning? You see, our sons are working and we can see that they are just We have to do the last check on our what's called laser shooting. So I'm gonna do that right now. Just Yeah, I'm gonna applause and add Where is our feet? That over a pre fed and add on my own laser Poor up. And one thing we have to do is to put our start position a bit more up. So we do not have that sound with the ball. So some around here that's there. Now we start our game to be here. It we still do. And yeah, this sound is working this. So never mind. That is not big of a deal. So I'm gonna change that back 0.75 and that is that. That is how we had some bets to our game for the simple But it easy quickly. And that's the it Guys come are here and I will see you guys in the next. We do