Unity 2D Game Development Course | Jack Donaldson | Skillshare

Unity 2D Game Development Course

Jack Donaldson, Game Designer & Programmer

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
18 Lessons (2h 7m)
    • 1. Class Overview

      1:47
    • 2. Game Concept Overview

      8:13
    • 3. Installing Unity & Visual Studio

      4:33
    • 4. Unity Project Setup & Layout Basics

      6:29
    • 5. Visual Studio Layout & Tips

      5:56
    • 6. Importing Assets & Textures

      8:27
    • 7. Creating A Basic Level Outline

      6:54
    • 8. Setting Up The Ship

      10:54
    • 9. Ship Up & Down Movement

      12:15
    • 10. Fixing Ship Up & Down Movement

      5:17
    • 11. Ship Left And Right Movement

      5:03
    • 12. Level Creation

      10:37
    • 13. Level Progression

      5:07
    • 14. Start Level UI

      6:24
    • 15. Making A Main Menu

      8:39
    • 16. Adding Game Music

      10:00
    • 17. Building Your Game

      2:44
    • 18. Class Project & Wrap Up

      7:16
46 students are watching this class

About This Class

Easily Learn To Make Amazing Games!

This course aims to teach students with no experience how to turn a board game into a PC game! This class teaches you how to turn the board game Rush Hour into a PC Game. Using the free game engine Unity, students can learn how to make a fully functioning game and how to create levels from scratch. 

Concepts Covered

By the end of the course students should have an understanding of the following concepts:

  • Unity & Visual Studio Installation
  • Navigating In Unity
  • Steps Required For Game Creation
  • Basic C# Programming
  • Designing Levels For Your Game
  • Importing Art Assets
  • Creating UI & Menus
  • How To Build/Export Your Game
  • Implementing Music
  • Basic Game Design Principles

Is this beginner and kid friendly?

This class is for students who are new to Unity and has no required knowledge but can still be undertaken by students who are at a more advanced level. The course has no adult themes and is suitable for all ages.

What You Will Need

  • 6-7 hours of free time (This is dependant on skill level and speed)
  • A modern PC / Mac capable of installing and running Unity (See specs here)
  • An internet connection to download Unity and Visual Studio

Transcripts

1. Class Overview: Hello, everyone, and thank you for looking at my course on skill share on game development. We will be going through and creating a game from start to finish in a matter of hours. So there are tons of different videos covering all the different bits off this game. So it starts off with videos on how to install uni and visual studio. That coding environment, um then tells you, had a navigate unity and official studio with some different tips and tricks, and we begin by importing our art, which we're getting from an open source project. And then we are creating our basic levels and setting up our ship movement as our game is based on rush hour. So this is a board game, and we're going to transform that into a PC game. So again, that first video is focused on how to do that and the different concepts of our game, and we will eventually move into making our ships move and creating different levels and making them more difficult, having adding some EU. Why, so that we have level information and a main menu again, we eventually adds a music at the end, and we finish off with how to build your game and exported to Windows Mac and Linux. Although as we're using the Unity game engine, you can export over 20 different platforms so you can export to whatever you want. Ah, the class project involves creating levels and sending your screenshots of them or even building your game and uploading it to school share. So please, I have a check out of the course. It's really interesting, and I hope you enjoy it. If you have any feedback, send me a message. 2. Game Concept Overview: everyone I am, Jack. And thank you for choosing to start this course. We're just going to run through our initial game idea and concept and just think through all the different components of it. We're just gonna do a very brief view of this is not gonna be too in depth. So I've just got a power point here that I'm just gonna go through and talk a little bit about. So we are trying to build a clone of the game rush hour. It's a board game where you move vehicles in a constricted area. Um, in order to get a specific car. So an example, for example, like you can see they some red car here, it's needs to get moved to the exit here, and you can, like, move this move the different vehicles back and Ford's to solve puzzles and get that car to the exit. So we're gonna be trying to make this, uh, into a digital game and transfer the mechanics all over into unity, which is the game engine. We're going to be using so one of the rules or constraints of this game. The first thing is we have fixed area or limited space. So you only have a certain, um, area that groups you only have a M said an area that you can move the vehicles ends, for example like we might have a three by three here, and you can only move the vehicles within this area. You can't move them outside of that. So you generally have boundaries which make it more difficult. And, um, living the possibilities of movement you have. Um the next thing is, you have other vehicles which also limits where you can do and create different puzzles. For example, this screen one might need to get to the exit here, but it can cause this. I read one him, um, the next. So you might have to move this blue one there and yellow one, then the red one, Dan and the green one out. Um, so other vehicles do play a big role in this game. Generally, you have to move a whole bunch of other things before you can actually even move the final vehicle to get it out. The next thing is that vehicles have toe have a certain direction that they can move. For example, the screen one could only go left or right. And this ribbon economic up and down this again limits the possibilities and makes the player have to take that into consideration. Um, the next one is that there's only one exit spot, for example, in this diagram, we've got the exit to be here. But you could only other exit over here or down here. We're like, so maybe you have to get the blue car to the exit here. Ah, the exit also plays a big role in how the player approaches the puzzle and having only, um, one exit, for example, if we made it. So if you just got any car outside of the grid, then you want it would make it a lot easier and require low less thinking. So how do we keep players entertained? This is, um, not necessarily specific to the game, but there's a few different things we can use challenges, which is the main thing we're going to be using this game is having them increasing difficulty throughout the levels. I'm not gonna go too much in depth on making. The levels will give you all the tools and knowledge to make Um um but you can make him as hard or as easy as you wish. The next thing is rewards. Generally games might give you skins on in game currency. Um, stories, stories entertain people. Ah, um, you a lot of this game specifically won't have much of a story, but that is a big thing again on the concept of rewards, rewards can also be finishing a level and failing that self filming like me award. I'm getting three styles and level could be rewarded. Um, it doesn't have to necessarily be the generic. You got this item kind of thing. Rewards can come under a lot of different categories. Um, differentiating gameplay. So, um, having different game plane of doing the same thing the whole time. This'll game is a bit difficult with that because it relies on one big concept. Um, but some much bigger games have lots of different avenues that the part of the plate can choose to go. To say they are want to do the puzzle aspect of the game rather than the mawr. Real time shooting aspects of its, um gtsi. Good want. So you might want to do a story related mission or you might want to rob a bank. That kind of thing. What platform should this be? Ah, this game would probably work best on mobile. But for now, we're going to be porting it to PC Aziz. This course is aimed at beginners Mobile. That's a lot more steps to it ends we doing It would take a lot longer to do. Um, where else? They're going to be building it with unity. And if you don't want to go for Bt or mobile, usually sports a lot of different platforms, A Z can say, here is the list of them you can export to the way you intend to switch Facebook game room . Um, even your TV's Ah, via so really the potential is there, you just need to take it, um, Web browsers. Another big one you can do so just cause we're building this for Windows, Mac and Linux doesn't necessarily mean you can't port it over to other platforms in the future. Because you need is very good at being a report to multiple platforms. So you can do that if you wish. Um, requirement. So what we are going to need we're gonna need art for this. We're going to be using three open source up packs because, um otherwise, this is in the course of the games on course. So, uh, we have chosen like a pirate ship. Themes aren't pack in. The videos are both through how to download all that. It's pretty simple. It's free for commercial use. So you can use it however you want. Ah, well, also the audio, sir. I again have found free, open source audio. All of these things I'm listing you can use your own. Um, all this interchangeable, you can change your own audio change, run up. The one thing that the third requirement here is programming. Um, sometimes it scares a lot of people sometimes. Ah, programming scary. Ah, going to be hopefully trying to. I have explained a lot of it. Failing that a lie. We haven't gone to in depth with the programming if you need to. There are links to download the scripts. If you do know you wish to do the borrowing, think you can, um, just copy along. You don't need to understand it, but I do go and explain everything that's happening. In case you are interested in that we will need to do a bit of programming butts. I try to do as little as possible so we'll see you in the next class on me starts away. I believe it's installing unity, so I'll see you in the next last Thank you for choosing this course. 3. Installing Unity & Visual Studio: Hello, everyone, and thank you for starting this course. It's great to be with you, so we'll jump right in. And in this video we'll be downloading unity and installing visual studio. If you've already done this Utkan skip ahead. But for everyone else who hasn't? First we're gonna open up Google Chrome or your Web browser, and we're going to go to the Unity website, which is unity. Three d dot com. Bacon. Just such unity. So now we're going to go toothy Big get Started button, which should take us to the download page. Now I am using you need 2018 and Unity is free for people who are earning under $300,000 a year. So what we're going to do is click try Personal. So this is the free version of using Now. There is no difference between the free version and the paid version as well. Just Thea funds Cat. So what we'll do is we'll accept the terms and conditions. I've really read that. Feel free to go ahead, and you can either download the installer or download uni hub. I am going to download unity hub because that is the newer version, and what this is is it allows you to gets lots of different versions of unity in one place and manage them easily, and it's more user friendly. So we'll just wait for this to download. And you can always standard install and follow the prompts. It will do the exact same thing now, Just remember, you may be getting a more up to date version. Um, so what we'll do is, once it's downloaded, we'll just run the uni hub set up. So what we'll do is we'll click. I agree. Um, you select your where you want it to be installed. I have changed mine, Um, and then you would hit in store. And once it's done that you would click, run and finish. So now that that's installed, you have you have a nice sugar on your desktop, and yours will probably ask you to sign in. So what you would do is you, then crane account, which is very simple and easy to use. Or you can log in using your Google Can I believe, um, and then what we do is go to installs and go to official releases and download the most up to date version, So just click download and what it will ask you to act opponents. So generally I go for Lennox Mac and Windows is already installed and you click done, and it will start downloading it. Now. This can take a while for slow, slower Internet sweets. So whilst we're doing that, I'm going to install Visual Studio. Visual Studio is a programming I. D. So integrated development environment for C shop and a lot of other languages is developed by Microsoft, and it's free. Unity does come with a free I. D called mono develop. You can use that as you choose. I'm just going to use visual studio. So if you wanna follow along with May, just open up Google and type in visual steer. Ah, I'm not going to go through the whole process of installing it because I already have it. But you just go to the website Visual studio Microsoft, a common go download windows. It's like Community 2017 communities. The free version. I'm pretty sure it has a license, so as long as you're not making money off it, you don't have to pay for it. There are some business ones and educational use ones as well. If you so choose. So you just download the visual community install. So you can then just run that and it will install it for you already have it. So I'm not gonna go through the whole set up process. But once you've done that, you should have visual studio successfully installed and you can move on to the next video . So thank you for watching this, cause I'll see you in the next video. 4. Unity Project Setup & Layout Basics: hell over on in this video, we're going to be going through how, the basic layout of unity and ensuring Just teaching you how visual studio is also laid out . So first, what we're gonna do is also create a project. So what we're gonna do is hit this new. We're gonna open unity, help which we installed in the previous video, and we're gonna hit the new. But, um, and this should bring up this window, and we're going to first give our protector name. So I'm gonna call hours pirate game, okay? And then we go to the template, and we're going to select a to D template because it's a two day, um, I've disabled uni analytics. That's not needed at the moment. Um, and we're going to select that location, so I've just preemptively done that. So once we've put all those settings in, what we're gonna do is hit the crate, predict one. Now, this may take a minute, depending on your computer speed. So this should bring up the unity lager, and hopefully it shouldn't take too long. Okay, now that we've got unity loaded, what we're going to do is you should have a screen similar to this. If you have things in the wrong spy and it looks very weird like this or something, what we're going, what you can do is just go window layouts. Default. Now, this would just if you ever move things in the wrong spot and can't fix it, press that button and it should put everything back to normal. So on our left hand side here we have out scene. So this tells us what's in it. It is kind of our level and all the things that are in it. So currently we just have a Cameron, so it's pretty bland. But what we can do is the camera is a object of sorts. So when we click on it, we can actually see the things about it on the right hand side and the inspector. So the inspector actually allows us to investigate objects and shows us a more detailed view on whatever we have selected. So that's what that is fought. So as you can see here we have, um, a objects names, main camera. Um, it has a tag with the main camera. It's on the default layer, and it's at this X, Y and Z position now X, y and Z positions. Ah, the location system that's into uses. So most you probably would have heard about Excellency coordinates. And why X and y coordinates. Sorry. Um, so as you can see, if we actually move our camera to the bright, the X increases em. If we did it moved to the left of the X decreases, and the same goes for the wife. Now, the Z is only used for three day. So that would be, um, currently what we're really not working on, um, and they'll be the blue axes. But what I'm going to is Tenet beckoned to D mode. If you ever get stuck in three day accidentally, Um, the two D button is right up here in this fool's which you between the two modes. Okay, moving on this view that we've also talked about a little bit is the same view. So this allows us to save what our level looks like in two day. So the hierarchy shows us our objects, but the scene view shows us how actual scene in today you learn more about it throughout the videos. So this is a three game tap. So this will show us what it looks like when we are actually running the game and testing it out, um, to actually run and test the game. We can click this big play button up here, and it does generally take a few seconds, and this will be what it looks like. This is us testing the game right now. We can also pause it. And But remember, if you want to make any changes, don't be in testing mode, cause if you're in testing murder, you make it change. When you go out of it, it doesn't save the changes now. Took me a saving. Um, one big thing is saving us scenes. So what we're gonna do here is in our bottom photo. There's kind of like a file explorer, um, in unity. So as you can see, we have a photo, and then we have a sane or level. So what we're gonna do is actually hit the delayed K here and delayed this ST and we're going to create right click here. Great. Sane. Um, saying and we're gonna call it, um, level one. And what we should do is be out of double click this and it will ask us if we want to save this scene. We go open, we want. And there were. So now every time you want to make changes, it's always good to hit control s or go file safe. Sing just so you don't leave your changes. Um, one of ah, big thing is, um, farm management. So I like to use a lot of folders. So generally folder for my scenes or levels photo from my scripts, which is your programming. Um, And I also have a photo for my, um, textures or images. I'll just leave it his images for now. So that is a basic rundown of the unity editor. For now, what we're going to do is actually go. And if you go toe edits and preferences, you can go to external tools. And some of you might have, um, visual studio here. If you do select that, um, if you did install visual studio, just select that so that it uses the visual studio to open scripts. So that's the basic rundown of the U. D editor. I'll see you in the next video 5. Visual Studio Layout & Tips: Hello, everyone. And welcome back to this video. This is gonna be on visual studio, the layout and a few basic shortcuts and tips and tricks for it. So if you already have use visual studio before or you haven't or you're using mono developed the default Unity one and you haven't install visual studio, then feel free to skip to the next video. So I'm just in a previous project of mine right now with a lot more scripts. So what you'll see is that in the X Project window you can via script. So to open it in visual studio, you just simply double click it if you don't have visual studio. If vigil shears no open when you double click it, just go to edit preferences, external tools and select visual studio here. Make sure you have installed it first, though, so you're just double click the script and then you should save Visual. Studio opens up nicely, and it does look a bit scary to begin with, but it is fairly easy and intuitive. I have the dark theme currently running, so as you can see here, I have my script in front of me. Um along the top bar here. I have all of my other scripts I have in my project that I've recently opened, um, to pin one here, I can simply just total the pin status. And a useful thing is to right click. It didn't go close over this because I generally find I have a 1,000,000 open and that just closes Oldham painting. It also means that doesn't get removed when you do that. Um, the syntax highlighting is very useful. Um, if you're not familiar with coating each in dent is one tab. So if you press to have it in dense at once, um, if you're in denting is if you select whole bunch and press tab, that is also another useful feature and in down a whole bunch of ah, cut once. Um, but if you do find that your code looks messy and the in denting zone messed up and it might look something like that, my favorite shortcut is control. K Control de. Okay, don't do it when you've got yield selected. Apparently control K control D. And what that does the order formats your whole document. So if you find that it's a mess, just press those case and it'll be wonderful. Um, another thing with visual studio is if you select a whole bunch of text, you can actually press this button up here or press control K control. See to comment out it'll so you can then use the button next to toe Uncommon it. But that is, if you like one of boat coming a whole bunch of stuff out quickly. Um, similar to how I've done here. Um, another thing is regions. So if you want to format your, uh, scripts, I just typed hashtag region and then give it a name somewhat like put, um, First Pickard's. And then I might want to go down here, and I want to end my region here. Now. This doesn't get read by the computer. It's just from or for what type of hash again region. What I can then do is just minimize it and says, First, better coat is old for keeping you code nice and clean. It's really useful. Um, don't worry. If you that's going all over your heads, you don't need no this straightaway to continue coating or game development. You learn along the way, um in your right hand side. Here, you have your panels. Oh, well, like you file explorer in visual studio is such so as you can see, a year. I have all my scripts in my project. Quite a big project. So that would be why there's so many. But yes, big projects tend to have a lot more scripts. Um, and that's ready. Other thing is control us, save or file save or several. Um, if your syntax highlighting isn't working, when you create a new script, go file, move this script into and then select there'll be an option here for assembly. See shop. Select that, and then that should help you Syntax highlighting. So what you can do is visual studio is really useful. Um, I can say something like string T equals that, and then I could. And then if I wanted to list all the functions, I could do it t I could take dot and then using the, um what I complete it tells me all the different things I could do because capitalization is really key when coding. So, um, another useful thing you can do is if you want to check if a line has Bean. Um, if the lines being run, then what you can do is if you right, click, you can go a break point insert break point. And what this will do is if this get line gets run, it'll pause the unity editor and tell you that is really useful. If you don't know if the lines being run or something's not running properly, you want to find out this stuff in, just remove it. You just click it again. But yes, really useful. So, um, that's it for this visual studio layout. It's pretty simple. Our control f is another thing to be out of search things. Something like one I don't know, Um, time dot delta time that's used a lot. And they are. It only has one in the script. They so, um, public avoid. That'll be in there a lot. They, uh no. Well, apparently it's only in there. Once our cause will study your study. That has a lot more. So it troll left another really useful thing, which is finding things. So yet you find all this stuff out after experimenting around. So I'll see you in the next video 6. Importing Assets & Textures: Hello, everybody. And welcome back to the next video. Um, in the game development. Siris in this video will be downloading out textures we're going to use, because if we had to go through making them, it would be a lot longer of a process. And we're tryingto teach game development. Here s so what we're going to do is first open Goo Crump. And then we will go to a website of a free open source textures. Four games. It's called Kenny. I think that's how you say Okay, me, um so it should come out straightaway. Three addresses, Keeney dot nl If you don't get that. So what you then need to go to is the assets. Uhm tap. Oh, Page. Sorry. And we're going to feel we're going to search for pirates as we are making a clone off rush hour the board game. So if we should find this pirate packet, make sure to get the two d one, not the three day one, or else you may have a few issues and we're just gonna go ahead and download it. So it's a reasonably small file on it. Shouldn't take too long. So once that's downloaded. Just go ahead and open it and just extract the files. So what we're going, Teoh, is that should give you ah whole bunch of different things. Now, we really even need this Pan J, um, photo. And if we actually look, we only need the things in the default size one. So if we have a look in here, you should be able to see that we have all the different images that we're gonna be using in our game. We're not even really gonna be using all of them, but it's all good if you want to expand it later on. So what we'll do is we'll right? Click and we will go copy. And if we open up our unity project right here and we go to our images photo we created last time and we go showing Explorer this then opens that photo. This is in our, um, unity project. And we can right click and go pace. Now, this should a copy over those PNG files. And if we click back into unity, it will hopefully give us loading bar where it just imports all of these files into a type it recognizes it should accept most images. PNG's J pegs gifts maybe. Yeah, I'm pretty sure accepts gifts. So anything you have, you should be able to easily import. So once that's done, you should be out of find your, um, pain J photo. And if we go to, we also have readiness size, um, and devote size. We'll just go with the default size for now, and we should be able to see our ships all in here or good. And if you when you click on these images and if they say texture, type default, make sure to set it to Sprite to D in your white, that is a big thing. If it does say that so, otherwise, you will have a few different issues later on. So if we go to our tiles Far folder now, we should be out to see what we're gonna be making out basic map with. So we have a water one here, so this will be out. Background is such. But to start with what we're going to do in our game window, we're going to click this, um, drop down here. Em. What you're going to do is click this process here and we'll give it a label. We'll just call it default resolution or base resolution. And what you should be able to do is type in select fixed resolution and put in 12 80 by 7 20 and hit. OK, I'm just gonna hit cancer cause I've already got it here. And this will just make sure that your screen sized days the same size and that we don't get too many weird issues later on. So please make sure you do that. So we're gonna help into the scene view here, and what we're going to do is actually drag al water tall in him. And we're just gonna name it water. Now that we've named this toe water, what we're going to do is we're going to try and make it a much bigger background. But what we will see is that if we drag it to make it bigger so we can actually select this rectal appear to make it bigger. So if you actually look in the game view, you can see that there's that Tyler water. But it's very, very small. So what we might want to do normally is to drag it all the way up here. But you say that that that doesn't work, does it? It's getting blurry, and it's not tiling. What we're gonna do is actually just press controls that twice. So it goes back to its normal size, and we're gonna change the drawer mode to be styled. Now, this may give us an error. You can actually work out what to do by reading. There is most the time. So this might this says to fix this change mesh type in the spreads import settings to full wrecked. So what we then do is we go to the water tile down here and we're going to change the mesh type in the sprites. Import settings to bay full wrecked, and we're gonna hit. Apply now. Hopefully, this shouldn't give us an error, so we can then do now is drag it. And there you go. It's tiling, so that is much better and exactly what we want. So this is the size of how, um read. This is the size of our resolution that we said So what we're gonna do is just try and make it fit as much as it can onto these borders. It doesn't matter if it's out too much anyway. But it's good to peace raise more as long as it just fills up the entire screen. Here. Now is a very big game off rush hour. But it's all right. Um, we're just doing it. You can always make the levels harder and smaller and put different things in different ways. 7. Creating A Basic Level Outline: So what we're going to do is we're going to actually, Bill, we're gonna organize their level. So we're gonna right click in the hierarchy and click create Empty. So this is just and empty objects that doesn't really do anything. And I'm just gonna set its position. Desires reserve. So we don't get any, um, movement issues, because when you make, um, so we're gonna make this a parent off, we're gonna call this level. So what we're going to do is actually, by dragging the water onto the level, make this the parent. So the way this works is when you move the parent, the child's move with it. So the child is the water, and we can actually have different. So if we just quickly do you think this you don't you follow wrong? But you see how there's thes two different objects that is a child of the parent. When we move the parent now, they both move. So that's what that's basic. Childs, um, copy things from their parents, but parents don't copy things from their charts, so that's a good way of understanding that. So I'm just gonna hit control us or file. So seem to say that. And what we're gonna do now is we're going to make the edges so you can really choose whatever tells you want for this. Um, I'm probably gonna choose the this one. This one looks like it fits. All right, so I'll drag this under the parent. And now, as you can see, well, as you can't say, it's going. Where is it? So this is a common issue. The way this works is it's a good understanding of layers. So if you've ever used photo shop, you know how layers work. There's things on top that could be seen and things on bottom that can't another way of understanding. This is if I go into three D mode. What I need to do is actually set this order and later be one. So it's on top of this water, so ah, higher number in this order and layer means it's on top. The basic way this thing works is that's, um if I just give you an example, I'm in three D mode right now. You don't need to copy May, but what it does is it puts this in front of the water. So that when the cameras looking at it, it looks like it's in front. There's what was happening before was that they this was behind the war. On the same spot is the water and that you couldn't actually see it because it was hidden so the water was in front of it and you couldn't see it from the cameras. Perspective. Now that's just a little understanding if you don't understand how it works, but you don't need to do any of that. Just make sure to set the order and layer to be one. If it's not appearing or if you want to hide it, native one, then it's gone. So that's just a simple trick. So this is facing the, um, a little trick is if you select an object, impressed f it zooms into it. It's a little trick. Um, so what we're gonna do is move it over the side here and we can actually see how much we can see here. Yep, that looks alright. So always take game view if you're bit unsure and efforts zooming. That's useful now. I'm using shortcuts to change between these buttons, but you can always do it yourself you can just see which ones I'm selecting. So I'm actually on the rectal of the moment, so I'll just move that in so you can actually see this white line is where the screen ends . But it doesn't matter if we're bit over. So we're going to set this one again to be tiled and in import settings were going to set it to be full, red and hit apply. So now we can go and go all the way down here all the way up here and, bam, we have a wall as such, so that our ships kind of look like they shouldn't go out there because we want to get our shit from the bottom to the top. And what we're going to do is name this to be left ball just to make it simple. Now, you can also just organize this by as many parents as you want. Um, the good thing about parenting, this is now. If we move these to the warm is with it, that's another really good thing that we want. So I just moved it down again. It doesn't really matter if you to inaccurate with this. So what we're gonna do is actually a little trick to save. Type is we're going to press control, see? And then what going to on Click Un Select everything in this vector impressed Control V. So this has made two copies of this war. So that's actually the shook up for copy and paste if you didn't know and we're just gonna parent it to the level again and we're going to name this one right wall. But how is this going to be a right wall when it's facing that way? Like if I would put it here, That just looks ugly, doesn't flatline. What we're gonna do is actually use the rotation tool and even actually rotate objects as much as you want. Now you can do it this way and try to painfully get in and hope it straight and stuff. But where you can actually do is just manually edited in here and everything. If we want a right angle, which is going to set a 180 degrees would be 9180 to 73 60 um, basic maths. And there you go. You've got your right walk. So that's actually as you can see if we opened up the game view here. It's a bit hidden and it doesn't look right. So what we're going to do is just bringing it out a bit more. We can actually zoom in and see where the say the line for the, um, screen is there. So we could just move past it and there would go that you look about even doesn't matter too much at the moment. We can always use masto work out what it was like before late, where outs, the bright positions and stuff is later. So what is going to save this scene? And there we go. We've got a basic seen ready to go and next level, hopefully next video, we can hopefully start adding some scripts and movement of ships. 8. Setting Up The Ship: Hello, everyone. And welcome back to the Unity Games development tutorial. So what we're going to be doing is quickly which jump right in and opened back up our genie project. So as you can see, we put out walls in last time. So this time, what we're gonna be working on is actually getting out shipping, and hopefully we can move it. So the first thing we're going to be doing is going to out images, photo P and G default size ships. And we will find our white ship, which is the one that we're going to be trying to get to the end. And we will just dragon backing. And now, as you can see, it's disappeared. So as we learned last time, what you need to do is just set the order and layer to be one. So therefore it's in front of it, and it's on a higher layer as such. So what is going to name him Main ship just up here. By changing the name, make sure you have him selected, otherwise you won't be able to and this one appear as such. Um, Now what we're going to be doing is actually we're going to be creating a script on him. So to first, where Gonna make sure we have a scripts folder and we're gonna go back in assets. We're gonna go to a script. So if you don't have it, what you can do is you right, Click create folder. And in our scripts photo we're going to create a C sharp script, and we're going to name it Livable object. Um, so this ah script we're going to use for all of our ships, So just double click it, open it, um, And it should have without visual studio. Or if you have mono developed, you can use that as well. It's basically the same thing. I just prefer visual studio. So once that's open, we're just going to quickly minimize it and go back into unity. And we're going to select our main ship, and we're going to drag are movable object into the right hand side when you have the main ship selected. What this does is it puts that script onto the object. Or you can just click the add component button and search movable object and added that way , don't at if you have two of them. Just click this cog up here and click remove component. So now that we have that on it, what we're going to do is also uses that component, but and we're going to search, Reach should 40. And we're gonna select the two d one because we're in a two dimensional game. And when it says body type, we're going to select Kinnah Matic so that we can, um, this I'm not going to delved. I'm not going to delve too much into it, But it may, the rigid body means is like a script that does a lot of physics, thinks and gives us a lot of helpful tools we can use to move our ships without having to do too much coding as such. Um, and Kinnah Matic means that if we use dynamic, it will have gravity. So if I hit play here, we might actually see that it gets gravity and it force. Yes, we don't want that. So make sure to select cinematic, and you should be all done. We can to save that. And if we go into our if we open up visual studio again, we can see that we we can then begin to use rigid body. So I'm not gonna go to into death from the coating with this, but we're going to You can always just copy long. If you don't understand it. That's fine. Um, it's getting it to work is a good step. So what we're going to do is we're going to create a number that we can change, which lets us, um, change of speed, that the ship moves when you drag it because it's rush hour. We're going to use the mouse to control it. So what we're going to do is create a ah number that we can change. So we're gonna set to public. Um, don't worry too much about this one. It means is that in unity we can change it, and that public basically means that it isn't hidden from us, and we can change it easily. Now afloat is the type. Um, how this works is float is a decimal number. We could use indigent, which is a whole number only. So 123 is a integer because whole number float would be like 1.251 point three. Anything with a 0.3 point one whatever. So that's that. And we're just gonna given name, so we're gonna call it movement Speed, and we're going to set it equal to 125 now. F just means float. You don't have to have it there unless you're doing ah decimal. If you do a decimal like that, it will give you an hour, and you have to put if there. But if we're doing 125 you don't have to put the f there. So just always leave the F on a float, just makes things simpler and gives you less issues. Now every line has to be finished with a semi colon. So that's the one with a comma on the bottom. Not the one with the two dots. Okay, that's just the right hands off a lk on a Quartey keyboard as well. If you can't find that, um, every pretty much every line we do will be finished in a call. A semi colon. Sorry. Now what we're going to also do is that rigid body we added earlier, we're going to gets a reference to it so we can use it in the code. So what So this is like our physics script. Basically, um, we we need to be out of access it. So what we're going to do is just type in rigid body to day, which is the type. So before we had a number as our variable or a reference this time, we've got a rigid body to day as our reference. This just means that if you accidentally say said it this to a number, it will give you an error and tell you why, as opposed. Otherwise, it will give you issues later on him wouldn't work, and we're just gonna give it a name, so I'm just going to call it a hobby and inthe e start function. So this is a function. Don't worry too much about this, but basically, everything in these curly brackets gets run at the start of a game or yes, started. When the level loads, everything in here gets run. Now, if you want to do a comment, these air things that don't get, um, read by the computer so there purely for human use, So I'm might say Jack is awesome. Now, the computer is not going to read this. That won't complain. It's just for me to be helpful. Probably wouldn't write that in the code normally, but it's just is an example of a comment. So what we're gonna do is this rigid body were going to set it because currently, you see up here how? With a movement Speed. We said it 225 here. We haven't said average body to anything. So what we're gonna do is we're gonna call, we're gonna say rigid body this rigid body is equal to, and then we're going to use a function. Don't worry too much about this, but it's called get component. Um, and this basically searches this if we go back to our object here. So you say this thing will search everything on this main ship and see, See you if it confined the thing we're looking for and we actually set what it's looking for here. So we say we're looking for a rigid body to day, and we have to finish this off with, um brackets otherwise will give us a narrow and we put a cassette McCollum. So basically, what it says is, hey, I'm searching. Everything on here is a rigid body to day if there is, then we set our baby to it. This can if there isn't a rigid body. Um, and we try toe access it, it will give us an era. So that is another thing that you might Well, careful. So what we're gonna do is we're gonna So actually. So here's an example of a comment. Would Bay get a ref get oh, set to try and set R B to a rigid body on our object slash ship. This 10 no exist. This could pay if Sorry, ship. And if there is no rigid body, we will get an error. Actually, a good way to check this so that we don't So that we know is if we we'll do a if statements that this basically says If RV So this thing is equal to nothing, then we debug dot log era, um, rigid body, not existing. Sure. And this will basically main that if we hop into unity, we can see that's so in our consul here. This will give us all out issues. This will tell us if you have this yourself. I quickly remove this rigid body is an example and hit play to test say, Look, I can't find a rigid body and it's not existing so But if we added a rigid body, um and I said Kinnah, Matic and hit play Look, we don't give that era. Okay, so that's what that does. It's always a good thing toe check if it's not there, otherwise, you can get issues later on a new coat. 9. Ship Up & Down Movement: we're gonna quickly get rid of this update function will just delete that. And what we're going to do is we will type a new function which is void on mass drag. Okay, so what we're going to do is this gets so I'll just do a comment here. You don't have to do this, but this gets called when we dragging the mass over our ship. So only when we're dragging it over the ship. So if I So if I was dragging the mouse here, wouldn't get caught. If I was drink here, wouldn't get caught. Belief was drinking here would be Okay, So that's a very important thing to notice is that it's only when the ship is being, um, dragged over now to actually get this toe work. What we need to do is add a collider. So this is a bit complicated, but it's not too complicated, actually, but we're gonna click, add component and box collide out to day. So if we zoom in here, we can see that there's this very faint green outline. If you can't see that too much, I can go into why frame and you can see it. That's a lot more obvious. So that's basically, um the rigid body uses and a few different things uses it. So, um, if when we are used playing this part game, um, if the Kaleida hits something, then the ship won't move in that direction. So it's it's used physics. Um, what's run? This? We're also going to go into a hierarchy. Include, create you I event system. Basically, that's don't worry too much about that, but it just lets us use the on mouse drag. So if we opened back up, out script again, um, we can start doing some code. So what we're going to do is say, um, uh, well, say, if in port, actually, we won't worry too much about this environment. Okay, We're going to do a Vector three, which is a position in the world. This is a bit complicated. Don't worry too much about it. So Vector three is a position in the world. It's like a point. So X and y think of it like that and we'll say it's a touch point. So and then we'll name it out. Touch point and the most equal to a camera don't main, so that means it's going to look in the scene and find out camera with the main camera tack , Um, so make sure you have that in the scene. Otherwise you might get issues, and then we'll say dot screen point strain to world Point. So this is a function it does some mass basically to figure out, and we're passing out input. Don't mouse positions. So basically, it's determines using where your mouse is that into coordinates? That's how it works. So this tons our mass point into usable three day coordinates. Woods Probably more to take ordinance just to know confusing, um, cause it's to your game. And then we'll do another Vector three. And we will say that our current position so out ship position is equal to and then to get our so this some variables gonna be equal to where our ship is currently, and we'll just say it's equal to transform dot position. So this basically looks at our if we are transformed component and gets the position from there. Okay, So don't worry too much about how that works, but it's just this is where is out current ship's position in coordinates. So Vector three perfect three is X Y z coordinates. So you know that, um, so next we're gonna do one victor, too. So, um, what we need to do this rigid body we have, we can add forces to it to move it in different directions. So what we're going to do is we're gonna create a vector to, so it requires affected. True. So we're gonna create evicted room, say, direction to move, and we'll set it equal to a new vector to, and we currently don't want to move any direction, but we will do some things to check which direction we moved on, mouse in to see whether we want to move our ship or not, because we want. If we move them us up, then we'll move our ship up if moved down with membership down, etcetera. So this is a variable is the word I'm going to use. So all of these things touch point ship pause, direction to move RB movements. But they're all variables. They're just things that we that contain a bit of a value or dot um, and would say this is variable, um, which we will use to say whether we move the ship. So what we're gonna do is would just do up and down for now. So we'll say. If so, this is this will basically run some code if this stuff in the brackets is true. So if out convert out shit position is less than, um, touchpoints adult. Why? Sorry. So I just set. So if ah y position is less than the touch point, don't. Why, then we are going up. So the way this works is if currently where our ship is, if our mouths is above it, then we need to move the ship to where the mouse is, which means we need to go up. OK, So what will say, then, is direction to move darts. Why plus equals touchpoints don't. Why minus ship position. I don't want. So we I need to move up. So figure out so sets the direction to move to bay the distance between Al Khoussa and the ships. So the way this works is it, um, gets the distant. This basically sets the direction to move to bathe the distance between the ship and the cursor on the Y axis. So up and down. So this basically says if Al Cosa is above the ship and what we can do here is we can say else if this is another condition. So basically, if this is not true else if ship position don't why? Sorry? If Sorry touch position dot Why? Or touch Point. Sorry is greater than again. So what we're gonna do here is will say if shit position don't. Why is greater than touch Point? Don't. Why we are going down. So if the cursor is below the ship, we need to move down. So we'll say direction to move. Don't. Why minus equals ship position. Don't what? Minus touch Point don't want. So we need to move. So basically the same thing here except downwards. So that's why we're using the same value. But when minus ing it this time. So it will be negative. So it might be negative one here, or it may be one here, so one would be up native. One equals down. That's the way it works. And at the end here, we're almost done. So it was a RV dot philosophy equals Sorry. We know we're not We're gonna see RB AdForce forced to add. Sorry, we're gonna say direction to move times al movement spade from up here and we're gonna do a bracket. I'm gonna say force mode today. Got force? That's just that. So the way this works is basically gives the rigid body we put on the physic calculator. It says, Hey, we want to move this direction and we're gonna use the generic force type. Okay. Can you please do it for us? Um, now, if we save this control us as always. So what this basic laws is tells the rigid body such physics calculator to move us in the direction. Wait, Want? Okay, So if we open up our unity project right now, we can then go into and hit the play button. We will notice that we can't move out ship. So the issue with that is because it's set to Kinnah Matic. We are unable, Teoh use the force method on it. So if we would have said it touch dynamic, we can Well, if I actually caught it, if I was able to set it to dynamic, we can actually move it now. We will fix this in the next video, but currently this, um, we will need to set it to dynamic when we're moving it and then Kinnah Matic so it stops because the issue is if we have it on dynamic all the time, it will. I have gravity will affect it. And also when other ships bump into it, it will be affected and move. So we don't want that. So in the next episode will cover how to fix that. 10. Fixing Ship Up & Down Movement: Hello, everyone. So last episode we had the big issue where we couldn't actually move it until it was set to dynamic. So this episode we're going to try and fix that. So what we're gonna do is open up, out script, so we'll dive right into this. And how we gonna fix this world? First issue we're going to try and fix is the setting it to dynamic when we're touching it . So we will add a new function called Void on Mouse Down. What does this do? Well, this runs the code inside of it. The frame we click down. So basically it only runs once at the start of us dragging it. So this is exactly what we want. So what we want to do is then say RB dot is Kinnah Matic equals false. So basically Well, when we click down, we want to be a to move it. Now. If we go into unity, we can then hit play. Once this loading by down here needs to go first so we can hit play, and once we move it, we can then move it. Great. Now what happens when we on click? Oh, it's going Okay, so we need to set it back to Kida Matic when we've stopped moving it. Otherwise it just flings away. So how are we going to do that? We go to our new function. Boyd on Mass up. So what we will do is say this runs when we stop moving a ship. So we will then say R B is Kinnah Matic equals true. Stop moving. Stop moving. I'll shit and allow us to move our ship. So if we go into unity, what we should say is once this loading bar is gone, we can it play and we can move. Great. Now there's a few issues here which should be out of a fixed by one Monaco. But it is actually working mostly. So as you can see when we move a ship, it's still moving. Why is that So the issue with that is that it's velocity is still being set, and it thinks that should move now. We can easily fix this by saying in the en masse up bobby dot velocity equals do vector to syrah Syrah. Stop moving. Completely simple. Right? So if we open up unity now and we hit play great look. It stops now. Looks like it's working. But we have one big issue again. We gotta move it. Whoa, it's black. Get no, I don't think you could play a game of Ah, I don't think you could play this game when it's like that. It would be a very big challenge, but I don't think we want that. So what we're going to do is in our on drag function. Before we add the force, we're just going to set the velocity equal to 00 What happening is every time we go to move it, it's getting Foster and Foster and foster and fussed from Augusta. We only want him so that distance that we want to move it in the AdForce is going and adding and adding and adding and I think we only want to move at that distance and nothing else. So we're going to set it to zero the velocity of Ciro before we move it each time and there you go. We can now move it, so that's what we want and if we want to change the speed, we're just going to the main ship object and we change the speed by setting it to something like 400 or something ridiculous. And there you go. It's much faster and much more responsive. And you could also even go something ridiculous like 100 and 34.98 And it's dependent on how fast you want to move. So it's kind of up to you. So as you can see here and the inspectors also changing toe dynamic each time we touch it, which is exactly what we want. Say, yeah, you can see if you click it has this president Cool. So that's it for this video. We've got our ships to be moving, and next video we will hopefully be adding in moving it across ways, so I'll see you in the next video. 11. Ship Left And Right Movement: Hello. On n. Welcome back in this video, we're going to be letting our ship move Teoh left and right as well as up and down. So what we'll do is we'll jump right into our scripting. We've been doing a lot of scripting in the past few episodes, but we're almost there. So if we open our movable object script by just double clear, um, we should. So what we can then do is it's pretty simple to get it to move left and right. Um, So all we have to do is, as you can see, if we look it, this code is moving in on the Y axis. We just have to copy and paces code to work on the X axis, which is the left and right one. So I just quickly go through and change all of these wise to exes once I've copied it. And basically that boat one more. Why that? Okay, So, basically, if the curse that is to the left actually to the this is to the right hand side, because the at the touch point would be to the to the left, does the left. If it's the left, we're going left. So we need to move left If the customers to the right off the ship. We're going right. We need to move. Right. Okay, So that's those comments fixed up. And now of immunity, we should be able to hit play once it's done loading and we can Whoa. Okay. Yeah, it moves left and right now, but it also moves every single direction. And I don't think this will be a very fun game. So we're gonna do some simple code to fix that, because we should only we should only have our ships be out a move like that, left or right, or up and down. Otherwise, we have issues. So save that, OK? And if we now go up to the top of a skirt, what we need to do is I'm not going to explain this code too much because it is pretty. It's not too difficult, but it just is more of a, um, helpful thing. So it just allows us to easily select whether we're going up and down or left and right? So if you just copy these two lines of code, you shouldn't have too many issues. I'll explain what it does. Well, I'll show you what it does, actually. So if we go into unity once we've added those two lines of code, make sure to save every time. Otherwise your uni went update, you'll see that we have a drop down here, which allows us to select either left and right up and down. That's basically what those two lines of code do. Um, I won't go into too much debt. So if we go back into a script and we go down here, basically the way it's gonna work is we're only gonna run the up and down coat if we've selected to go up and down. So if our movement options that were some movement options is what we have, and if it's equal to up and down, then we will only run this code. Now make sure that your brackets are where that I like this. Otherwise you will have issues. So then what we can say is else, and I am deleting this last bracket and putting it after these ones. So the way this works is that it's, um if we can go up and down, then we run the up and down code else, so only if this is not true. So then if we're going left, then right, we will run the left and right code. So now if we jump back into unity, we should be ever to see that if we hit play, we can get up and down or we can go left and right now. So that's only if you select these two things now. I can't go up and down with us. But look, it's moving. Why is this? Well, it's because when we're going up and down, we were directly setting the y velocity. But because we're going left and right, we're not setting the war anymore, and gravity's affecting it. So how do we fix this? Well, it's pretty simple. We just go into a rigid body and we set it to dynamic, and we just sat gravity scale to zero. Pretty simple fix, and it's not too much of an issue. Just settle back to cinematic once you've done that. And if we hit play and we said it to be left and right, it's no longer moving, so this is exactly what you want. So in the next episode, we will be adding, Um, fixing these walls and adding a few more ships. So thank you for watching and I seen accepts it. 12. Level Creation: Hello, everyone. And welcome back to this section of the course Today we're going to be building our levels and setting up the basic things to objects and pre fabs. I know scary words to Ah, help us start building our levels. So we're going to delve right into it. So the first thing we're gonna do is going to our main folder and right click and create a new photo. I'm gonna call this one pre fabs. Basically, what we're gonna do is make it easier for us toe, make new levels and build copies. So the first thing we're gonna do is open this photo and we're going to drag the main shipping. So what this allows us to do is easily create copies off this ship. So we can just now just drag it in and it should work right away if we just move it. So now all these move and exactly what we want, So I'm just gonna get rid of those quickly. And now I'm just going to try and do the same thing with lots of different other ships. So we're just going to navigate to well, um, ships images. So I'm actually just gonna copy and paste a our main ship here. And I'm just gonna call this one red ship, and what I'm gonna do is just drag in this Red Ship image and set it to the sprite render. So looks like a red ship now. And what we can do is if we then go back to the pre for for a week and then drag the red ship in and now we can create copies of red chips very easily, so I'm just gonna quickly do the same. But I'm also going to do someone that go left and right, So it currently will have the main one and the red one go up and down and we'll just do some to go left, right? So again, I'll just copy and paste and we'll do this one conveyed grain ship. So I just moved that one this way, and what I'm gonna do is rotate it on the zed by 90 degrees. So up here in the transform, I have the green ship selected, and I'm just going to have in 92 this will then rotate it or you can use three rotate tool , appear to put it on different angles. And then I'm just going to drag the green ship texture in and said it to be left and right . So now we can just again track this prefab in, and we can create lots of ships, grand ships that go left and right. So I'm just gonna quickly do the same thing for the blue, yellow and black ships. Okay, so now I have, um, six different preferreds by different ships. We should now be able to start creating a levels fairly easily. So it now these bump into each other. Oh, now this has encountered an issue that we need to fix their rotation. Now, this fairly easy. I'm just going to open up our movable ship class from last game. So here we go is fell easy to Evan. So once we open that, I'm just going to go up the top here in the start function. And underneath this debug log message, I'm gonna type in if movement option is equal to left. Right? So if we, um, are moving it left and right, we're going to say our baby doc constraints equals rigid body constraints to date a phrase position. Why and we want it to be rigid. Body constraints dot freeze rotation So what this does is phrases rotation and up and down movement if ship goes left and right, so basically it means that it can go up and down if it's supposed to only go left and right , and it also can't rotate, which was the issue. We're facing them. So I just do the same thing here and say it's secretive phrase, Position X or Or words that end in this case. And this is the same thing Freezes rotation, off left and right movement. So for all the people who, um, on into the programming, I am going to leave a download link for these same from this point forward so you can create your own levels. So now if we hit play, what we should be able to see is that we don't have this issue anymore. But we do have the issue with the movements feet. So an easy way to fix that and is we're gonna just select all of our ships and we're going to see collision detection continuous. So this just veins that it does more accurate collisions, so hopefully they shouldn't go through each other. That's those two issues we had fixed. And now we can move on to our level building. So what we're gonna do is we're gonna create some more pre For one thing, we're going to actually, Is it with their left and right? War is with select these two and we're gonna just a component box collider today. And as you can see here, it's very hard to tell. But it's Saturday. I'm going to show white frame. You can see it's added a collider here, but it's not big enough. So what we're gonna to is actually just go on the why and scale it up. I'm just going to do a ridiculous number because it doesn't actually matter. This just means that our ships can't go, can't hit. Those colliders will go past them. So it's pretty simple. So basically a ship should only be had to go up and down. Um and we're just gonna make sure that happens now. What we're also going to do is create some rocks so that we could put in our levels may have been more difficult. So if we go into our images for a p and J D foot size tiles. You could say that there's different rocks in here, so I'm you can just drag a few of them in. Now if you actually select and make sure to set the order and later he won, otherwise they will be hidden. The same thing goes for ships. If you have that issue, um, and now it's we select Elise, we can just add the component books fly to Today and you say that it just hopefully now for your play way, you can't go past those rocks. If you don't have the box collider, your ships will be able to go through those rocks, as you can see here. So make sure had the books, collide them and just check. It's on all those. And there you go. That's basic tiles that you can add to it. Um, you can also add like curvy edges and that sort of thing I'm going to quickly adds one mawr , Um, one more, ah, collider along the bottom. So I'm actually gonna make I'm gonna actually do this easier. I'll just do the ah, I just get a tile here that I can use to show about what's where it is. Just me is so descript, Al 69 You can use whatever you want. Just gonna set its order night, everyone. And now if I said it to be tiled, it needs to have the messed right before Rex or just quickly to that. And now, if I used the rectal up here, I'm just gonna drag it to be the whole way along here and add Component box collider to day and expand this on the X axes this time. So this just means that cause we want our ships to start down here. So actual main shit, we want to start down here. We don't want him to be out of go further down. And if I just like this and then on check the spry render that hides it. So I'm just gonna name this bottom foundry and put it in the level here, so that should be about it. You can. Now you can see that these conquer past, and that's exactly what you want. So you could always add all of these different things you can add like trees and sorts of things on top of it, just by dragging the men's pretty simple. So I just might want to put something there is to make it look pretty. You can use all these assets. They're all free. So just experiment safe people you can find you can put, like if you wanna have, Like, Rex ships is obstacles. You can just drag them in, set up to one and just out of collided to them. Anything with collide of the boats wouldn't be out of hit. So if you see if we put that there now, these boats can't go past it. So use. And you can also do your own custom textures. Feel free to experiment. So, um next that's the end of this episode. Next time, I will show you how to go to next levels and finished. I make it finished point for your levels. 13. Level Progression: Hello, everyone. And welcome back. So this will be a short episode. We're just going to show how, toe finish our level and go to the next one. So what we're gonna do is we're just going to create a empty object him. So right, click in the scene. Do you and click create empty and we just drag it up here and we'll add a box collider component. And I'm just going to scale it along the X. So it goes hallway on. So the way this works is, once this gets touched, if it's touched by the white ship, um, it will go to the next level. So what we're going to do is actually so what? His name? This one finished point the point. Pretty simple. And I'm gonna add us new script so I can click out component here and go finish point, finish up. Um, and quick enter. So this will credit new script for us. And if we just double click, this visual studio should open up on what we can do is right here. Weaken type in void on trigger. Enter today and hit. Enter and it should order complete this if it doesn't just copy this. And then what we're going to do is if we up the topia will type public string next level, same name, and we just say that equal level two for now, we can always change this in the Inspector later. And up the top here, we're just gonna add a library. Don't worry too much about what this means, but just type this up the top. Otherwise you'll get errors. So using uni engine dot seen management. And in this function, we're just gonna right If collision dot compared tack and we're gonna type main ship now, this needs to later on, we're gonna add this tag to this ship, so you need to make sure this is spelled the same. I'll explain later on when it's gonna say Seen manager, don't lock. Uh, load scene next ST level. See? Name. And if we say that we can then hope back into unity. Um, and one, what we have to do is go to our main ship. So just select that anger tag, ad tag. And this I'm guy called my main ship. So this has to be the same as whatever was in your code right here. Okay, so you need to create the name of this tag to be the same. And then we just select our ship and go set the tag to be main ship and hit. Apply so pretty five updates as well and you can save the saint. And what this should mean is that there's a rock in the way so we can actually complete this. There's also a ship in the way so we can actually complete this. But let's say so. Really hard level. We hit play, we can't go anywhere with stuck. We move this out of the way and then we go to the end. And what? We've actually done two things wrong here. So with the finish point we need to check is trigger. That's a big thing to do. And what we need to do is actually have a place for it to go. So if we go into a scenes photo here, I'm just gonna click show an explorer and it should open up your file explorer here, and I'm actually just going toe copy this level and rename it to be level two. So now you should see a level two here. And if I open that, it looks exactly the same. But you can see up here, it's changed too little, too. So just moves and things around. So it's obvious that we've changed the level and that sort of thing. Um, okay, and we're going to go file. Build settings is important for every level you want, Teoh add. You have to click add open scenes in the build settings now, and it actually do the same thing in the main menu as well. And I just drag it up the top here. So level one is the one at the top will be the one that is unloaded first. So level want to be loaded. You need make sure level Tuesday, and the name of this scene needs to bay set in here, so Level two needs to be equal to that. So now if we hit play and we moved this really hard level, we can go up there and they go. It loads the second level. Now, so and then it loads itself at the moment because we haven't got another level, so that's how to load simple levels, and you can do as much as you want From this point forward, you can, um, build what? The levels have it as hard as you want, and you could make it as long as you want. Um, I think in the next video we will be working on a menu. So thank you for I'll see you in the next video. 14. Start Level UI: Hello, everyone. And welcome back in this episode, we're gonna have a Ah, you. Why, that comes up at the start of a level and tells you level name, and it goes away after a few minutes. So to start off with were actually going to open the internet. So I'll just bring that up here. And what we're gonna do is go to Ah, um, same place we could art, which is Kenny. And we're going to go to his website and go to the Assets page. And I'm going to search click on the U I category, and he has a whole bunch of funds up there, which is very useful. They also he also has a whole bunch of you. AIPAC's there as well, but we're not going to get into that in this Siri's. So we'll just download this. And if we open it into the photo, we can then, um, extract the downloads it far or if you kind of wins it being this quick extract all and in these funds, photo would just copy it. And if we open up unity, we can go into images folder. Oh, actually, we're just showing explorer so in here. Um, go to the assets photo and just copying the fonts folder into here. And that's just simply allowing you to use the funds in unity. You need to have ah dot t t f fall, I believe true. True text one. Um, I'm just drag that into the scripts folder that so I think the front we're gonna be using is probably Ah, Kenny. Futuristic. Now eso you, Why is an interesting thing? So what we're gonna do is we actually need to create a U Y canvas first. So this scales with the screen size. So if we look on the this is actually the screen size, so it's a bit awkward to get used to, but I'll try and explain. It is Vesa can. And in this canvas, we're going to create a u I text. And as you can see here, we have out text. So I am just going to take best fit and make it so it could be very big. So what this does is depending on the size, it just scales the text with. It just means that you don't have to manually just it. So as you can see this is now appearing on here, and we can actually change the font. So it might we want wanted to make any future narrow or Kenny future, or which you can use any fun you want. Um, I might I'm going to go for Kenny. Many square, actually, that looks all right. Um, you don't have to choose symbols May. And we're gonna I'm just gonna use, um text, which is, um, level one. Okay, um, and I'm going to set it so it aligns in the center of the text, and what we can then do is just to line it to the center of the screen. So now the text tells us what level we're loading. So these theatrical points and I'm not gonna go too much in depth with them. Just, um if you click on the wreck, transform, appear and select this bottom right one, it means that scales with the screen size, depending on what it is stuff ago. Um, just don't worry about it too much. Um, it just means that it was hopefully not have any scaling issues when you on different PC screen sizes would be the issues. So in this on this text component were actually going to create a new script that we're gonna call it destroyer. It's really complicated scripts. All that's going to do is just kill. Um, we're going to say is in the stop method, we're gonna have a public float. Um, time to kill. And we'll set that two seconds, and then we'll say, destroy this game object and will give it the time to guilt. So what this basically does is allow it just, um, dilates the game object after the time we specify, Um, in this start method, we're also gonna actually, um, se get component text. Um, what Went not use. We need actually put in using you Need engine, don't you? Were I first So that we can actually access the U Y types in code. Um, and then don't worry. Too much. Mothers in them will set the text equal to, um, we actually have to using uni engine dot seen management as well, so that we can get the same name. So we'll say Seen manager dot Get active scene. Don't name. And there we go. So what we should be able to do now is that script should be honor. It should be in two seconds. And if we copy this canvas onto the other level as well and we start level two, we should see that the canvas gets changed to the level name and it destroys after a 2nd 2 seconds. You can change the time by, um, just clicking on the text here and just editing it. So if you want it to last five seconds, we have set five. And if we started, we got one too. Three full five. What they say about five seconds later, I just can't a bit fast. So that's simple text for starting different levels. So if you see when we go in Level one, if we play, um and we go to level to it, then goes a little too, and that's going to five seconds. Could they didn't change it back. So and then that restarts level two by doing that because we don't have 1/3 level yet. So that's how to get some basic text up. And in the next few episodes will be doing a menu system as well. So I think if watching and I'll see you in the next episode 15. Making A Main Menu: Hello, everyone. And welcome back to this class today, we're gonna be working on some main menu, you y and hopefully adding some music. So the first thing we're going to do is go to a scene's folder and we're going to right click create saying, and we're just gonna call this one that made many. Ah, pretty simple. And we're just gonna other hit, enter or double click it. Open it. Um, we can right click and go open. So once you've done that, um, we're gonna go into the same view here, and we're gonna write, clip in the hierarchy. Um, go to you. I canvas. So we conceive got out. You are here, which is what we're going to be putting I'm a many one. Um, so we can really design is he wants. So I'm just gonna quickly create a, um, nice panel, which I'm going to use is the background. So I'm just gonna have ah, probably fully black background. So I'm just gonna name this background final, so I just change the color here, um, with this slider by clicking on and selecting the background panel panels just like a square of color. Basically um and I'm just gonna make sure that check this box down here so that it scales properly. Um, on top of this, I'm going to right Click create new are you are ends like text, and I'm just gonna bring it up of it. I'm going to set the color to be white, and this is just gonna be the title of our game. So we're gonna call it, um, rushing pirates, because I really cannot. Can't be the bed name. And I'm just going to change stick best fit here, increase the maximum size, Said it to be in the middle when it's lined, and I'm going to change the front of something that looks all rights. So we have got to go with Kenny Pixel Square because that looks OK and I can just make it is because I want I can just check for the game view, see how big it can be, and I want it. So I'm just gonna align it up the top and being the center of the screen and what I'm going to Dio is actually see these anchor points. I'm just gonna move them so that they align with the whereabouts. The title is in the moment. So I'm not gonna go too much into death with how the scaling works here. But this is just my total text. So just stay with that. You couldn't really do whatever you want with this side Rushing parts And what we're gonna do is right. Click. You are. We're going to create a button. So this button is going to be a, um, stopping. So I'm just going to make it quite wide, and I'll center it and just move these anchor points again. So it fits properly. And this could be Well, just name it stop on. And I would just open this and I can see the text inside of this product numbers gonna change. Start. And I'm also going to dig best fit and increase the maximum size. Said it to be on bold. And now that's beginning to look. Okay, so we play now we can see just to take this bottom works when we over over it Highlights if you can see that highlight color too Well, you can change it the color that it is when it's highlighted here. So now it should go red When I let it, but because I'm in play mode, it doesn't keep its changes. So stop on an, um we'll have a bun that allows us to turn our music on and off. So what is I just copied this with control sink stove, and I'm gonna name this one music tuggle bun. And I'm just gonna drag this one, Dan. And there we get. Actually, I'm just going to give it up a little bit like there, and I'm going to set the text to be tuggle music, and I'm just gonna copy one more button and I'm gonna name it. Quit parlance, we're just It'll be the quick fun. So, um, quits fun, and then we'll just change the text in here to be quit. So now we have all three buttons. So, um, what we're going to do with out stop on is I'm just going to click on this button here and click add component, and we're gonna be start game script, and we can just double click on this. Open it. Now that we've got this open in visual studio, I'm just going to I looked through the hierarchy here and find the finishing script and I'm just going to copy all of this and paste in the start game script and just changed the name here back to start game script. And what we're gonna do is change this to be a public void, and we'll call this start game and I'll just get rid off this. Get rid of this if statement So it should look like this. And I'm just gonna press control to K and control Dida order format and that should be a start game script done. So what we can do now is if we look, um, with this bottom, we're gonna click this plus here, dragging the stock game scripts and select the function to bay Start games grouped start game and the level we want to load is level or the name of the same. We wouldn't load. Sorry. So now if we open on my menu and we hit, start it loads of one. So that's exactly what we want. So now what we're going to do is we will work on the quick buttons. So we're just quickly at a script, quit game and we're just again opening up in visual studio and will say get rid of this public Floyd. Quick game and we'll say application don't quit. So all this does. It's just closes the game. It's pretty simple. Script on. We're getting an issue. Ah, sorry. Okay, so say start quit. Came to the issue here was that the name of the function was the same as the script. Doesn't like it when we do that. So if we just save it like that should no longer be getting an error. We just press the plus here again, Dragging the quick games could select function to be quick game and start quick. Get Now, this won't really work in the editor, but when we build it, it will work. So I believe in the next episode we will be building it. Um, so that's how to make our main menu. The last thing we're gonna do is what we'll do is we'll go to our final level for May. That's this second level, and we will go to the finish point and I'm gonna change the next level. Seen name to be main menu. So now we just say that scene. Last thing I would do is go file build settings at open scene and drag may menu up to the top. So now if we play what we should be able to do, supposed to stop, undergo, deliver one, and then once we get a Level two that works and then we go toe. We finished our final level and it takes a spectrum a menu, and the quick bun doesn't work in the editor, but it will when we build it. So thank you for watching NRC in the next episode when we work on our music. 16. Adding Game Music: I live on, I'm welcome back. So in this episode, we're going to be implementing a music into the game. Pretty simple. So the first thing we're gonna do is I'm just going to quickly download my royalty free music from the Internet. So I my favorite website, uses open game out dog. So I'm just gonna quickly download it. You can use MP three files, files work. So once I've downloaded that or you've got your music file, you don't need to copy me. So we'll just copy this music file and go into Oh, yes, it's photo. These scripts actually need to be reading the scripts photo. So that's good. So I just came here for a call it audio. Once we've done that was open that and then he fight open my downloads, and I should just be had to drag the music castrating. And here we go. So I should be able to know play my music and it's incredibly loud. So sorry if that hurt your is, um, once that's done, what we're going to do is create an empty objects were going to call this music player, and we're gonna add the component audio source. And we're gonna also add out a new script court for, uh, music player. And we'll just quickly do that and it should open. We should be out of open it with visual studio. So now it was, say, is we're going to do a bit of coating it, So the first thing we're gonna do is create a boo um, music on and well said, It's the truth. And in this thought things were going to say is if player preps dot get k dot get strength music enabled so well, I'll explain what this is doing in a minute. So if outside has K is what I meant to do then we say If player preps dollars get strength , music enabled equals true else. If play preps don't get strength, music enabled equals false, then we'll say musical on was false music on Equestria. What this is doing is it's checking. If we have saved this, have saved this setting to the computer before. If we have, then read it and tell us if the music is enabled. So play approach is a way of saving um, Datta when theatric ation isn't running. So it might be like a, uh, music volume. Whether it's on all these different kind of stuff doesn't have to be related. Music, consent, whatever you want. It just you can access it between when used on, stopped the game and a lot of different times. So if we start this game and talking music off, then when we opened it again, it will be off. So then what we say in this will create a new function called void? Um, try play music. M will say if music zone them was Say, get component 40 years source. Stop play else. Get component. What do your source don't stop. So what this says is, if we have If we have enabled music enabled music, then play it. If not, don't play it. Okay, So in this stuff, function within, gonna call, try, play music and we're going to do one last function, which is public. Avoid, um, Tuggle music. What this is gonna be too is at Baden is going to call this function called by our button. And then what we're gonna say is if music's on, then we'll say music on equals false. So well else, our music's officer will set it on them. And what we're also gonna do is say, play preps don't set string music enabled Tau Bay both and I'm just gonna copy the same thing and said it to be church. So what this is doing is saying hey, where toggling our music. So if it's on, turn it off and make sure to save it If it's, um, off in, turn on and make sure to save it So next time loaded starts, and next time we load, it doesn't stop. And then we're going to say is try playing music and that should be what we need to do for now. Sophie Oven Unity back up and just quickly effort, Load. What we can do now is in our audience. So sciatic are just drag in our audio clip or our music that we imported. I'm gonna untech plan awake. I'm gonna take Luke and I'm going to just bring the volume down cause I know my clips very loud. So now what we should be how to do is if we go to our local music button, we just click plus on the on click, add inthe e music player, object and click um, total music. And now we should let it play. We're playing now music playing very loudly. And if we took a look, it should stop, And we took a look. It turns back on. So there we go. That's how we have our music. The only issue is when we hit start, it doesn't, um, continue through to our levels. So we're just gonna open up for just read again and had one line of code which is in the start function, don't destroy and load this don't game object. What this does is it means that it stays between scenes. So you said, don't destroy unload this. Stop game objects. That's just keeps the So now you stop. It's playing. Now we do have one issue, which is that when we go back to the main menu, Wait Get to music players. Now, this is an issue. So to fix that, um, all we're gonna do is what it's gonna open up visual studio and we're going to add up the top here. We're going to say, using any engine like what? Spell uni engine. Don't see management, and we're going to create a new function called void changed active scene and in here we're gonna say seem and its current saying and we're going to do another same, which is, uh, saying going to and now, you know, start function. We just say ST manager dot active scene change plus equals changed active scene, and we removed back it. Sorry. So now we should be able to Now this will get cold whenever we change our level, so runs every time we change the level. So what we're gonna say is, if the same were going to is dot name is equal to the name of our same, which is main menu. So if your main menu seems called something different put that in there. If we're going to the main menu, then we just say destroy this stock game object. So that's pretty simple. Basically, if we going to the main menu to avoid duplicates, wait, destroy this game object. So now it's going on main menu. And if we save it and hit play when we go and complete all of our levels, we don't get to music players playing. So thank you for watching this episode and I'll join you in thing next tutorial 17. Building Your Game: Hello, everyone. And welcome back to this tutorial. So we're going to be building our game, which is what you do when you are trying to play it on other devices. And you don't have the unity editor in store. So first thing we're going to do is go to edits Project Settings Player. Now, this is where you change all the details about a game. You can change the icon in your company. Name your product name. Um, for instance, company. My name might be Jackson. Call whatever. Just putting what you want. Um, Now what we're gonna do is go down to resolution and presentation, and what you need to do is actually unti everything except 16 by nine. Otherwise, you have resolution issues. So once you've done that, you go file, build settings and make sure your main menus up the top and all of your levels out in order below are in order. Doesn't matter too much. This But just below the main menu needs to be a top. If you don't have your saying that, open the scene in click add opened scenes toe quickly at that. Um, Now you can choose the target platform Windows, Mac or Lennox. If you don't have these options, you need to get a unity hub and installed the Mac and Lennix build options. Umm, I generally go for times 86 score 64 because it runs on both. And then you can pretty much hit the bill button here once you put all those settings. Now, I've just made a build photo here, and you just select your builds photo and then you just let it go and your unity should start building again. So shouldn't take too long, cause it's only reasonably small game. But more level you have, the longer it'll take. So once you have that, you should have all of these files. Now, you can actually send this to whoever you want. But you need to send all of these files, not just the XY. Um, and then they just don't click the XY and it should open up your game so they can select the resolution. So 1600 by 900 on it place. And as you can see, it opens up the game music and everything's working it start the game, we can play way, complete the game and the quick works, as you can see when it didn't in the editor, and that's how to build your game. So if you want to ever send it to other people, you can even build other platforms. But I won't be covering men's video. Um, yes. So you should be out of build to Windows, Mac and links. So thank you watching and I'll see you in the next class. 18. Class Project & Wrap Up: Hello, everyone. And welcome back to this last video. It's just gonna be a quick, um, wrap up and I'll give you some official about that class project on the school share. So, federal class project. So ah, what you can do now that you finally built things game. Uh, and if you have a look back in the levels of your stock or unsure of anything, I want to see you guys create your own levels. Take a screen shot of him, uploaded build and submit it as a class project. Um, you just have to go to school to have page go to the your project button right next to three. Community one. If you just scroll down on Nate videos, we want you to fragrant levels. Ah, submit screenshots to do that. It's pretty simple, if you can if you want to. You couldn't submit a build of the game so other people can play it, but we just want to see what you have created as um, this is all about learning and being creative. If you have had issues throughout it, rather course where you haven't gone something to work or script is and working or thesis unknown errors appearing. We have ever touched a file of the most up to date project. So you can just download that extracted open unity. Press the open button, and ah, you should be out of over the project and create your own levels from there. If you ever stuck, just read this page. It's on, um, your product have again and just hit the massive crate project button down the bottom. So, yes, thank you for watching. And if you do want to do that thing, please try to create some levels. It's really a good learning experience and helps reinforce the knowledge that the unity editor, um, Now, I'm just gonna run through some things that hopefully this course is taught you, um, you might know Bay 100%. Ah, at them. But least it's given you a little bit of an idea about, um So the first thing was having still union visual studio That was one of the earlier on videos. Um, the next thing is have navigating unity, navigating in a to D space. Um, some people haven't done that before, and it's a very new thing. Ah, if you I can learn how to do that. It will help you a lot. If you want to get into three D modeling, you need to learn how to navigate in a three D space, which is a bit more difficult, but this is a good starting point. Ah, next thing is had a create a game, the process of creating game from start to finish thing that audio, our programming, all these different things and how they combined together to create a game. Um, they have done a bit of programming in the course. Um c sharp. You probably don't understand too much of it, but at least you have an idea of how it works. I tried to comment a lot of the code so you can understand what's happening. Next thing is how to design levels for your game. Ah, again, that close project supposed to help reinforce that, But how to create different levels, make them your own is the biggest thing with that importing art assets as earlier on we, um when it's a kid Keeney website and got all the art to make it look like this pirate game . How to create you I menus. So we made the make main menu. We also made the text that appeared told you what level you run so you can go a lot further with that. We only doubled in the very basics of you. I had a build next for your game. That was one of the later videos. And so you can release it on Windows making Lennox. And you can also follow pretty similar SEPs to release on other platforms as well how to import and implement music. We head out background music playing. That was again one of the most reason videos, um, again, basic game design principles. How to turn that board game into a unity game. Uh, steps we took, um, and originally analyzing what we wanted to do from that bowl game. So again, please challenge yourself and try to improve the game. If you wants my dears, I've just putting a few down here. You could add sound effects at a level select menu. These are all advanced things. I'm having covered them as of yet. I made you and events course later. Um, but please try. Gugu is your friend. YouTube is your friend finds as many from resources. You can and you can work this out, require multiple ships to get to the exit. That was something that I was trying to think about. How that would work it, make it a bit harder. Um, adding time limits for levels that would definitely make it a lot harder. Now blowing of n ships. Eso you might have steep strategically choose. If you have, like, two bombs at the side of the level or two bombs for the whole game. You have to choose which ones you blow up. They might even be like, make it easier kind of option, custom level editor in the game. Now, this is a a much harder thing. If you want to try and attempt that, please. If you attempting any of these things and have trouble that send I have my contact details in the next slide, please send me a message from school share or send me an email. I will be happy to help clean urine art and stylized version of game Don't like Kenny. Assets don't like pirates make a spaceship one. Make it in space. I want to see your r and see what you can do with this so again. Thank you for watching this closet. Supports me so much. Um, if you enjoyed it for me in school sharing Teoh, keep up today. If I post any new courses, um, and please share with friends family? If you enjoyed it or even sent me feedback. If you didn't like it, I would love to see how I can improve. Um, biggest thing is, stick to get in development. If you try hard enough, you will definitely get there. Um, is a very hard field. Um, if you do have any questions, send me a message on school show. Email me at Jack Donaldson's. Here's your five at gmail dot com. Um, I should be able to get back to you. Ah, reasonably, um, quickly on there. Although I am in the Australian time zone. So maybe the middle of night when you message me, but or I will try to get back to any emails I get given. Um, and I am happy to help again. If you want to extend your games, please do so. I would love to see what you can come up with. Post them on the class projects. Um, share them. I want to see what you can do. So again, Thank you for watching Theis course. And it really was wonderful. So thank you for watching.