Book Image

Learning Unity 2D Game Development by Example

By : Venita Pereira
Book Image

Learning Unity 2D Game Development by Example

By: Venita Pereira

Overview of this book

<p>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.</p> <p>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.</p> <p>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.</p>
Table of Contents (17 chapters)
Learning Unity 2D Game Development by Example
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Let's simulate the world


Now that we have a better understanding of the basics of physics and we know about the new Physics 2D in Unity as well as Box2D, we are ready to make use of all these faculties to create our very own physics game.

We will create a very simple physics game similar to Angry Birds. We will have a cannon that shoots out cannonballs.

We can shoot out cannonballs by pressing the Space bar, and we can control where the ball lands by increasing or decreasing the power of the cannonball using the W and S keys.

The aim of the game is to shoot the crates and planks in the scene. We won't need to set up animations since the physics will take care of all the movements in the game.

The environment

The first thing we will do is create our scene with the background, foreground, and props that populate our environment.

Creating the scene

To create the scene, we do the following:

  1. To create a new scene, go to File | New Scene.

  2. Name it Scene and make sure you save it.

  3. Within the Project Browser...