In this video Jesse Freeman teaches you how to set up the project by importing previously created code from Jesse’s Unity 5 2D: Advanced UI and Unity 5 2d: Movement in an RPG courses. These will become the foundation of this project as you add battle logic on top of the RPG. By importing this code, you’ll also speed up your game’s development.
- View Offline
- [Voiceover] Before we get started, we're going to need to create a new project. Let's go ahead and name this project RPG Combat. Pick a location where you want to save your project and switch to 2D mode and then create the project. As you can see, I've already gone ahead and configured Unity to the way that I like to work. I put the hierarchy and inspector panels on the right, the project and console panels below, and I stacked my scene above my game panel. The other thing we're going to want to do is change our resolution from free aspect to one of the other standard ones.
In this case, I'm just going to pick 16 by nine. This way, when we import our artwork, it will scale correctly based on this aspect ratio. Now this course is based on two previous courses that I did, my Unity Five, 2D Advanced UI and my Unity Five, RPG movement. I've gone ahead and packaged both of the source codes for those projects into Unity packages. Now it's not required that you watch the previous courses in order to do this one, but it may help.
We're going to set up this project exactly how we need to in order to focus solely on building RPG Combat on top of the existing code base. Let's go to the asset menu, import a new package, and select custom package. Inside of your underscore resources folder within your project files, you'll see we have an advanced UIV one Unity package and an RPG movement V one Unity package.
Select the advanced UIV one package and click open. Unity will show you the import wizard, and as you can see, all the files for this project are already checked and ready to be imported. Let's go ahead and import them now. Next, we'll want to import all of the code from the RPG movement course. Let's go back to assets, import package, custom package, and import the RPG movement package. Make sure that all the file are checked and click import.
If you look in our assets folder, you'll now see that we have an advanced UI folder and a random map gen folder. Each part of our RPG is going to be encapsulated into their own folder. This makes it easy for us to reuse the code by exporting them as Unity packages and importing them in future projects. Before we move on, let's go ahead and set this up so that we can start building out our RPG Combat, let's create a new folder by clicking inside of the project panel.
Go to the create menu and select folder. Here, we're going to call this battle system. Next, let's go back to the underscore resources folder that came with your project files. Here, we're going to select artwork and resources and drag them into our battle systems folder. Let's also open up the battle systems folder and create two new folders, one for our scenes and the next for scripts.
Now let's configure the artwork that we just imported so it's ready to use. Click on the artwork folder and select the first item, and then while holding down shift, select the last item. We're going to optimize all these textures. We'll start by changing the pixels to units to one, unchecking generate mid maps, change the filter mode to point, and set the format to true color. Then hit apply, we'll also want to select the battle window border and open up the sprite editor.
Here, we're going to add a border of one to each of the sides of the sprite. This will allow us to scale this spray correctly so that the edges don't distort as we stretch out the window. When you're done, click apply and close the editor. Let's also go into the resources folder and select the new island auto tiles. Here we're going to change the sprite mood to multiple and we'll do the same configuration as we did to the previous ones. When you're done, hit apply, and go into the sprite editor.
We now need to cut up each of these sprites. Go to the slice menu and switch the type from automatic to grid by cell size. Change the pixel size to 16 by 16 and the offset to two by two and padding to two by two, then hit slice and apply. And now all of the artwork is set up for our project and we have all the code we need to build upon.
- Preparing the user interface
- Creating game and message windows
- Building a battle window
- Adding a monster and action buttons
- Creating an actor class
- Adding player and monster attack actions
- Triggering battles from the map
- Ending a battle
- Cleaning up the battle and attack systems
- Rewarding the player