Book Image

Unity 2D Game Development

By : Dave Calabrese
Book Image

Unity 2D Game Development

By: Dave Calabrese

Overview of this book

<p>Prepare yourself to travel back to the 90s and build a game like they used to make, using today's technology. That's right; we're talking about making 2D games using Unity!</p> <p>This book will help you build 2D games in Unity using the engine's 2D technologies added in Version 4.3. You'll learn the basics of importing assets and building foundation technology all the way up to full combat and boss battles! With the book's straightforward and practical approach, each chapter takes you a step closer to the final game. We will wrap things up by looking into the basic aspects of the game's UI.</p> <p>Once you reach the end and have integrated a final boss battle, you can go back to the challenges included in each chapter and use them to improve the game and your 2D game development skills!</p>
Table of Contents (13 chapters)

Preface

Howdy and welcome! Take a seat and grab a drink. There you go. So, you say you want to learn all about this old-fashioned 2D stuff in that new-fangled Unity game engine? Well, you've come to the right place. Er, book. This here book? It's all about using those awesome 2D updates that Unity added in v4.3 to make an entire game. Yup, a whole, basic platformer, complete with parallax scrolling, enemy logic, UI, and a boss battle. Pretty sweet deal, eh?

What this book covers

Chapter 1, Introduction to the 2D World of Unity, covers the basics of getting Unity up and running for 2D games and setting up a simple, animated, sprite-based player character.

Chapter 2, It Lives!, is all about camera control, 2D triggers, player death and resurrection, firing a weapon, and a bit about state machines for good measure.

Chapter 3, No Longer Alone, adds enemies! Shoot them, get killed by them, and watch them patrol. It's a party where everyone wants to kill you!

Chapter 4, Give It Some Sugar, shows you how to build dynamic, endless enemy generation and a bigger game world, introduces parallax scrolling, and adds a scoring system.

Chapter 5, The Ultimate Battle of Ultimate Destiny, lets you know that the enemies have a friend, and he's angry! In this chapter, you will build an entire boss battle.

Chapter 6, The Finishing Touches, is exactly what it sounds like—the final gravy on this awesome mountain of 2D goodness. You'll be adding in game rounds and a start screen.

What you need for this book

This book is intentionally developed for only those who need one piece of software—Unity 4.3 or newer. That's it. Don't have Unity? No worries, you can nab a free version of this most excellent game engine from www.Unity3D.com.

Who this book is for

This book is ideal for anyone who wants to learn how to build 2D video games or wants to expand their knowledge of the Unity game engine. To get the most from this book, having knowledge of C# and Unity is important, however, if you are less experienced in these areas, this book still gives you all the necessary tools to create your own game.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text are shown as follows: "Import the image labeled Platform.png."

A block of code is set as follows:

case PlayerStateController.playerStates.idle:
playerAnimator.SetBool("Walking", false);
break;

case PlayerStateController.playerStates.left:
playerAnimator.SetBool("Walking", true);
break;
 

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "To do this, select playerSpriteSheet in the Project tab and look over at the inspector."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title via the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the color images of this book

We also provide you a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from https://www.packtpub.com/sites/default/files/downloads/2564OT_ColorGraphics.pdf.

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.