2D Game Development with Unity
eBook - ePub

2D Game Development with Unity

  1. 428 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

2D Game Development with Unity

About this book

This book teaches beginners and aspiring game developers how to develop 2D games with Unity. Thousands of commercial games have been built with Unity. The reader will learn the complete process of 2D game development, step by step. The theory behind each step is fully explained. This book contains numerous color illustrations and access to all source code and companion videos.

Key Features:

  • Fully detailed game projects from scratch. Beginners can do the steps and create games right away.
  • No coding experience is necessary. Numerous examples take a raw beginner toward professional coding proficiency in C# and Unity.
  • Includes a thorough introduction to Unity 2020, including 2D game development, prefabs, cameras, animation, character controllers, lighting, and sound.
  • Includes a step-by-step introduction to Unity 2019.3. Extensive coverage of GIMP, Audacity, and MuseScore for the creation of 2D graphics, sound effects, and music.
  • All required software is free to use for any purpose including commercial applications and games.

Franz Lanzinger is the owner and chief game developer of Lanzinger Studio, an independent game development and music studio in Sunnyvale, California. He started his career in game programming in 1982 at Atari Games, Inc., where he designed and programmed the classic arcade game Crystal Castles. In 1989, he joined Tengen, where he was a programmer and designer for Ms. Pac-Man and Toobin' on the NES. He co-founded Bitmasters, where he designed and coded games including Rampart and Championship Pool for the NES and SNES, and NCAA Final Four Basketball for the SNES and Sega Genesis. In 1996, he founded Actual Entertainment, publisher and developer of the Gubble video game series. He has a B.Sc. in mathematics from the University of Notre Dame and attended graduate school in mathematics at the University of California at Berkeley. He is a former world record holder on Centipede and Burgertime. He is a professional author, game developer, accompanist, and piano teacher. He is currently working on remaking the original Gubble game in Unity and Blender.

Frequently asked questions

Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription.
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
Perlego offers two plans: Essential and Complete
  • Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
  • Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Both plans are available with monthly, semester, or annual billing cycles.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Yes! You can use the Perlego app on both iOS or Android devices to read anytime, anywhere — even offline. Perfect for commutes or when you’re on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app.
Yes, you can access 2D Game Development with Unity by Franz Lanzinger in PDF and/or ePUB format, as well as other popular books in Computer Science & Computer Graphics. We have over one million books available in our catalogue for you to explore.

Information

I

The Basics of Game Development

CHAPTER 1

First Steps
In this chapter, you’ll take your first steps as a game developer. You’ll install Visual Studio and Unity. You’ll explore C# and some basic mathematical concepts. Best of all, you’ll make your first game, a simple game in Visual Studio. Your goal is to learn how to use these game development tools. There’s no better way than to dive right in and make something with them.
This book was written to let you follow along with a series of steps. By doing this, you will experience firsthand what it’s like to be a game developer. There are hundreds of numbered steps in this book, requiring you to pay very close attention and to do them in order, one by one. Many of the step descriptions are followed by additional explanations, descriptions, or screen shots.
You’ll need to have access to a PC or Mac to follow along with the steps in this book. Your system needs to meet the development system requirements for Unity. In January 2020, the Unity company released the 2019.3 version of Unity. That is the version used for this book. Here is a summary of the system requirements for that version of Unity:
  • OS: Windows 7 and Windows 10, 64-bit versions only; macOS 10.12.6+.
  • CPU: X64 architecture with SSE2 instruction set support.
  • Graphics API: DX10, DX11, and DX12-capable GPUs. Mac Metal capable.
Look at unity.com for details. While not strictly necessary, it’s highly recommended that you have at least 1920 × 1080 resolution for your screen. A multiple monitor setup with a fairly recent graphics card is a good idea in order to enjoy Unity even more. If you don’t have multiple monitors, the use of Virtual Desktops in Windows, or Mission Control on your Mac, is a worthwhile alternative.
If your system meets the requirements listed above, it will also meet the requirements for the other software used in this book. And yes, you’ll need fairly fast internet access, the faster the better. Some of your downloads will be large and time consuming, but once your software is installed, you’ll be able to work on your game without internet access.
If you’re like most game developers, you’ll have access to several systems, old and new, laptops and desktops. Your older laptops may not be compatible with Unity, but they can likely be used for doing Visual Studio projects and for the creation of graphics, sound, and music. They may be good enough for testing your games. Testing on older systems is an important facet of game development if you intend to distribute your game for play on PCs or Macs.
This book focuses on the development of games for PCs and Macs. Unity got its name from its ability to create games once and deploy them to many targets such as desktops, consoles, and mobile devices. All games in this book will run on PCs and Macs, and most of them can be modified to run on consoles and/or mobile devices with some effort. The process of taking a game from an existing platform to another one is called porting. Porting is easy in Unity when compared to writing your own game engine and getting it to work on all of your target platforms. Each platform has a long list of specific requirements, especially if your goal is to produce a commercial release. The number of supported platforms for Unity stands at 25 as of 2020. You’ll need to do your own research on the current details of porting to, and developing for your intended target platforms.
It’s easier to learn the basics of C# inside of Visual Studio rather than Unity. You’ll want to have Visual Studio installed anyhow when using Unity, so in the next section you’ll install Visual Studio.

Visual Studio

Visual Studio is Microsoft’s suite of development tools. It supports a plethora of languages, among them C#. In this section, you’ll install the free version of Visual Studio. The Visual Studio 2019 community edition can be downloaded at visualstudio.microsoft.com. Go ahead and install this. Under Workloads select “Universal Windows Platform development.” On a Mac, follow the specific instructions for Mac installation. This is a somewhat large install, so be sure you have enough disk space and time to download and install.
To test out whether the install worked, the first step is always to write a “Hello World!” program. This is a minimal program that only displays the text “Hello World!”.
  • <Step 1> Run Visual Studio 2019 Community Edition.
  • <Step 2> Sign in or create a Microsoft Account, if necessary. This is only needed the first time you run Visual Studio.
  • <Step 3> Click on “Create a new project” in the Get started panel, as shown in Figure 1.1.
    images
    FIGURE 1.1 The Get started panel in Visual Studio 2019.
    On a Mac, this interface looks different, but you’ll also see a way to create a new project.
  • <Step 4> Click on “Language” and select C#.
  • <Step 5> Click on C# Console App (.NET Framework) or (.NET Core). Compare your screen with Figure 1.2.
    images
    FIGURE 1.2 Creating a new project in Visual Studio 2019.
  • <Step 6> Click on Next.
  • <Step 7> Enter Project Name “Hello World”.
    On a Mac, use the project name “HelloWorld”. On a Mac, project names may not contain spaces, nor can you have an exclamation mark.
  • <Step 8> Optional: Enter a project location.
    This would be a good time to set up a folder for all the projects for this book. It’s up to you to name and create that if you wish.
  • <Step 9> Click Create.
  • <Step 10> Add this line of code inside the Main function:
     Console.WriteLine("Hello World!"); 
    Your screen should now look similar to Figure 1.3.
    images
    FIGURE 1.3 Hello World program in Visual Studio.
    On a Mac, you won’t have to type in the Console.WriteLine line of code, as it’s there already. Also, there’s only a single “using” line.
  • <Step 11> Control-F5 to compile and run it.
    This step automatically saves your work, compiles it, and runs it. Whe...

Table of contents

  1. Cover
  2. Half Title
  3. Title Page
  4. Copyright Page
  5. Table of Contents
  6. Acknowledgments
  7. Author
  8. Introduction and Overview
  9. PART I The Basics of Game Development
  10. PART II 2D Game Development from Concept to Release
  11. Appendix I: Game Development Glossary
  12. Appendix II: Rules for Game Developers
  13. Appendix III: Game Development Checklist
  14. Appendix IV: Legal
  15. Appendix V: The C# Coding Standard for this Book
  16. Index