Next lesson playing in 5 seconds

  • Overview
  • Transcript

2.1 Create the Project

Let's start by creating a brand new project. We'll use the iOS Game template and make sure that we select Swift for the programming language and the SpriteKit framework. We'll also add background and bomb assets to the project in this lesson.

2.1 Create the Project

All right, so let's begin by creating our project so we can start to build out our game. So the first thing that I wanna do is make sure that I've opened up XCode. And also you can head out to the GitHub repo for this particular course, and you can go ahead and download the assets that are gonna be required for this project. Now, you could do that and use the assets that I have procured from the Internet. But really, all you really need to do is go out, and you could either use those or go out and find some other assets, some sort of background for your game. And maybe some other image that could be a bomb or a missile or something like that. Or ultimately, you could create your own if you really want to, or just use some of the random shapes, circles, or squares, or what have you. Whatever is easiest for you, but you can definitely get started with these that I have provided. So really what I want to do now is I want to create a new Xcode project. And I want to select iOS, and I want to select a Game, and that's going to allow me to create a SpriteKit game. Then I'm going to hit Next. Then I'm going to give this a name, and we're just going to call this SpaceBomb. And I want to make sure I have an organization Name, an Identifier. I want to make sure the language is Swift, the game technology is SpriteKit. And we're going to make sure that this is going to support an iPhone. So you could do iPad or Universal, but to keep things simple for this particular course we're going to stick with iPhone. Then we're going to hit Next, and we're going to select a location. So in this particular case I'm going to just create this on my Desktop, so we'll hit Create and this is going to create our project for us. Now, a couple little tweaks that I want to make here is that I want to stay within my Settings here under General. And I wanna come down to the Deployment Info here. I wanna make sure that I uncheck Portrait and I just wanna be able to handle Landscape Left and Landscape Right. So this game is going to be played in the landscape orientation, 1so the user is gonna have to twist their device to be horizontal. And then I want to make sure that the Status Bar Style is Default. And we want to hide the status bar, those things should be done by default for you, but just in case that's what we're looking for. So now that we've done that, I wanna make sure that those things are saved, and then let's just have a look around here for a minute. So this is gonna be a very simple kind of boilerplate application. We have our AppDelegate, we have our GameScenes and our Actions. We have our GameScene.swift, this is actually where we're going to be doing most of our development. But what you'll see after this lesson is, we're going to wipe everything out of here and pretty much start from scratch. We have our GameViewController, which we're probably not really going to be touching all that much. A little bit here and there just to kind of get things rolling, but after that we're going to leave things alone. We have our assets here and as you can see by default, we're given kind of a blank app icon as well as this spaceship. And we're actually going to utilize this spaceship. So if you've ever created a game using the SpriteKit template within Xcode, and you've noticed that it has a spaceship in here, and you just kind of threw it away. Well today we're going to use that, so that's kind of a nice feature. And then that's pretty much all we're going to be touching here. So one thing that we're gonna do to get started though, is we're going to go ahead and import our assets. So I'm going to open up my Assets folder here and I have a background and I have a bomb. So what I'm gonna do is I'm gonna select these two .png files that I'm going to drag them into my Assets here. So now, I have this background which gives me the little three clouds here as well as a little bomb here. And really that's all we're going to need. So like I said you can go out and you can find your own assets, find other backgrounds, find other bombs, or whatever have you. Maybe you don't even have to use a spaceship, you could use a bat and a ball, or you could use something else. It doesn't really make any difference. Really, all we need is some sort of sprite or some sort of node to throw out on the screen to make this a very visual game. And this is what we're going to use to get started. So definitely feel free to tweak this as we go. So really all we want to do at this point is we want to run this one time, just to see it get up and running on the simulator. And to do that we're going to, I'm actually going to change this from the iPhone 7 Plus. I'm going to drop it down to the iPhone 7 just because of the resolution of my screen, so it doesn't take up too much space here. And then we're just going to run our application. And you're going to see that if you've ever played around with this particular template in previous versions of Xcode, the default app has changed a little bit these days. So it does show up a little bit something. You do get this Hello, World! And if you tap on here, you get these little squgglies and things kind of change. And you can drag along here, it's a cool little animation. Not very useful but at least it's something to get started. So in In the next lesson, we're going to start to kind of get rid of some of this boilerplate code that we're not going to need anymore. And start to actually build out the beginnings of our game.

Back to the top