Free Sample
+ Collection

Learning Unity 2D Game Development by Example

Beginner's Guide
Venita Pereira

Create your own line of successful 2D games with Unity!
RRP $26.99
RRP $44.99
Print + eBook

Want this title & more?

$12.99 p/month

Subscribe to PacktLib

Enjoy full and instant access to over 2000 books and videos – you’ll find everything you need to stay ahead of the curve and make sure you can always get the job done.

Book Details

ISBN 139781783559046
Paperback266 pages

About This Book

  • Dive into 2D game development with no previous experience
  • Learn how to use the new Unity 2D toolset
  • Create and deploy your very own 2D game with confidence.

Who This Book Is For

If you are interested in creating your very own 2D games from scratch, then this book will give you all the tools you need to succeed. Whether you are completely new to Unity or have used Unity before and would like to learn about the new 2D features of Unity, this book is for you.

Table of Contents

Chapter 1: Getting to Know Unity
Game development's background
Introducing Unity
Setting up Unity
Creating a new 2D project
Unity Editor interface
Project Browser
Extra Views
Chapter 2: Setting the Scene
What is a background?
Two methods to set a background
Setting a background using a tileset
The resulting environment
Chapter 3: Add Some Character
What is a sprite?
Creating a sprite
Importing a sprite
Slicing sprite sheets
Automatic slicing
Texture atlasing
Adding our character
Sprite Renderer
Animating a sprite
Animation Editor
Dopesheet 2D animation
Chapter 4: Code Control
Why do we need code?
Code fundamentals
Hello world
Controlling the character
Destroying the enemy
Unity Scripting Reference
Chapter 5: What's Your Input?
Input versus output
Input types
Output types
Unity Input Manager
Detecting input
Game controls
Chapter 6: Game #1 – Roguelike
What is Roguelike?
Adding a background
Animating the hero
Movement controls
Randomly spawning enemies
Animating the enemy
Enemy movement
Shooting projectiles
Detecting collisions
End game result
Chapter 7: Game #2 – Classic Arcade
Sponge antics
Game conditions
Adding an HUD
Font style
Resource management
The completed game
Chapter 8: Game #3 – Endless Runner
An agile ninja
The ninja character
Randomly repeating obstacles
Parallax scrolling
Add pizzazz with particle effects
Displaying the timer
The result
How to expand the game?
Chapter 9: Game #4 – Physics Fun
The basics of physics
Physics 2D
What is Box2D?
Steps to create bodies
Let's simulate the world
The final result
How do we extend it?
Chapter 10: You Are Ready!
Saving and loading
Creating a trigger
Putting it all together
Adding audio
The camera
Saving and loading
Space Buddy the alien
The second scene
Your journey ahead
A plethora of resources
Social media

What You Will Learn

  • Work with Unity's new 2D workflow and create a 2D scene
  • Set the scene with different types of backgrounds, either static or dynamically using a tileset
  • Bring your character to life through simple animations
  • Understand the core concepts of programming by creating basic code that controls a character and destroys an enemy
  • Create buttons and game controls by using code snippets for input detection
  • Develop five 2D games from genres such as classic arcade, endless runner, rogue-like, physics, and space buddy games
  • Add audio and feedback and deploy your games

In Detail

If you are looking for a guide to create 2D games using Unity, look no further. With this book, you will learn all the essentials of 2D game development by creating five real-world games in a step-by-step manner throughout the course of this book.

Starting with a blank scene, you will learn all about the new Unity 2D toolset, which will enable you to bring your scene to life. You will create characters, make them move, create some enemies, and then write code to destroy them. After figuring out all the necessities of creating a game, this book will then assist you in making several different games: games with collision, parallax scrolling, Box2D, and more.

By the end of this book, you will not only have created several small games, but you will also have the opportunity to put all your new-found knowledge into creating and deploying a larger, full game.


Read More