How To Make a 2.5D Game With Unity Tutorial: Part 1
A while back, you guys said you wanted a tutorial on “How To Make a 2.5D” game.” You guys wanted it, you got it! If you don’t know what a 2.5D game is, it’s basically a 3D game that you squish so the gameplay is only along a 2D axis. Some good examples are Super […] By Marin Todorov.
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress, bookmark, personalise your learner profile and more!
Create accountAlready a member of Kodeco? Sign in
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress, bookmark, personalise your learner profile and more!
Create accountAlready a member of Kodeco? Sign in
Contents
How To Make a 2.5D Game With Unity Tutorial: Part 1
45 mins
- Installing Unity
- Unity Editor Overview
- Setting up an iPhone Unity3D project
- Running the Game on Your iPhone
- Setting up the Scene
- Adding 3D Objects to the Scene
- Beginning Unity3D programming with C#
- Jumping the Shark
- Adding the Clown Fish
- Set Us Up The Bomb
- Prefabricating your Game Objects
- Bombing that shark!
- Where To Go From Here?
A while back, you guys said you wanted a tutorial on “How To Make a 2.5D” game.” You guys wanted it, you got it!
If you don’t know what a 2.5D game is, it’s basically a 3D game that you squish so the gameplay is only along a 2D axis.
Some good examples are Super Mario Brothers Wii, Little Big Planet, or Paper Monsters.
One great way to make 2.5D games (or 3D games too!) is via a popular, easy, and affordable game development tool named Unity.
So in this tutorial series, I’m going to show you how you can use Unity to create a simple 2.5D game called “Shark Bomber!”
If you’re new to Unity but would like to learn it, this tutorial is for you! You’ll learn how to make a simple game from scratch and learn a ton along the way.
In this game, you take control of a small but (well armed) airplane, and your job is to bomb the evil sharks while protecting the lovely clownfishes!
Unity doesn’t use Objective-C, so for this tutorial, you don’t need any Objective-C experience. However, some experience with an OO language is a plus – ideally C#, Java, or Actionscript.
Keep in mind that this is a Mac-users tutorial – Windows users might not find it accurate for their setups. Also, keep in mind you will test on an iOS device only (not the simulator) – so make sure you have a device ready to work with!
OK, so let’s dive into Unity – but be sure to avoid those sharks! :]
Installing Unity
First let’s install the Unity editor – if you already have it on your mac just skip this step.
Download Unity from its download page. Once you have the DMG file, mount it and start the Unity installer, after a standard installation procedure you will have a /Applications/Unity folder where the binaries are located.
Start Unity, and click the “Register” button (don’t worry, you can try it out for free). Select “Internet activation”, click Next, and fill in the form on the web page that appears.
Important: For this tutorial, you need to choose the “Start Pro / iOS Trial” option so you can publish to the iPhone (not the plain “Free” option!)
After registration completes, Unity should start up and you should see a window that looks something like this:
Close down the “Welcome to Unity” popup, go to File\New Project, choose a folder somewhere on your disk and name the project SharkBomber. Make sure all the packages are unselected, and click Create Project.
Now you’re at a blank slate. Wow there are a lot of buttons, eh? Don’t worry – in the next section we’ll go over it bit by bit.
Unity Editor Overview
Let’s do some additional setup to get things into a known configuration.
In the top right-hand corner of the application window you’ll find a select box – select “Tall” from the list. This will rearrange the window contents (the default was “Wide” FYI).
Now find the tab in the top left corner (just below the tool bar) saying “Game”- drag it near the bottom of the window until you see indication it’ll snap to the bottom and drop it there.
Now you should see the layout from the picture below:
Let’s go quickly over the different panels:
- Scene: Here you move your 3D models around and can browse your 3D world.
- Game: This is what your selected camera (in this case the main camera) sees – real-time until you use the editor as well; in this strip your game runs when you hit “Run” and you can test your game.
- Hierarchy: Your objects’ tree (much like the HTML DOM for example), currently you have only a camera, but we’ll add some stuff here later on; the objects in this list are currently present on the scene.
- Project: This is the contents of your project, your assets, audio files, everything you will be using now or later on.
- Inspector: Here you see all the properties of the selected object in the scene and you can adjust them; unique about Unity is that the Inspector is alive when you run your scene so it’s your debugger too!
- Toolbar: Here you have the tools to interact with the objects in your scene and the Run and Pause buttons to test your scene.
In your Unity3D project you can have many different scenes and you can switch between them. Currently you have one empty scene open in the editor. Let’s save it.
- Right-click inside the Project panel and choose “Create/Folder” – a new folder appears.
- Rename it to “Scenes” – you can do this by single left click on the folder name, or by selecting the folder and pressing “Enter”.
- Now from the main menu choose “File/Save scene” – navigate the save dialogue to [your project directory]/Assets/Scenes and save the scene as “LevelScene”.
Phew! OK – that’s done. Let’s check – in your Project panel open the Scenes folder – there’s your LevelScene scene. Cool!
Now we are ready to run the game – hit the Play button on top! Not much changes – but in fact your game is running inside the Game panel! Don’t forget to stop the game by clicking the Play button again (this is important!)
Setting up an iPhone Unity3D project
One of the nice things about Unity is that it can build games for iPhone, Mac, Wii and other platforms. In this tutorial we’ll be building an iPhone game so we need to setup some details first.
From the menu, choose “File/Build Settings” and click the “Add current” button to add the currently selected scene to the project. You can see when it’s added that it’s got an index of “0”, which means it’ll be the first scene to be loaded when the game starts. This is exactly what we want.
From the Platform list select iOS and click “Switch platform” button. The unity logo appears now in the iOS row.
This is all the setup we need for now, click “Player settings” and close this popup window. You’ll notice the Player settings opened in the Inspector, we need to set couple of things in here too.
In the “Per platform” strip make sure the tab showing an iPhone is selected, like so:
There’s lot of settings here, you know most of them from Xcode, so you can play and explore yourself later on.
Now use this inspector to make the following changes:
- In the “Resolution and Presentation” strip for “Default orientation” select “Landscape Left”.
- In the “Other settings” strip for Bundle Identifier put in whatever you want (except the default value)
- In the “Other settings” strip set the Target device to “iPhone only”.
One final touch: To the left under the “Game” tab now you have available different orientations/resolutions – select “iPhone Wide(480×320)” to match the default landscape orientation.
Congrats – you now have a basic “Hello World” project that you can try out on your iPhone!