Book Image

Mastering Unity 2D game development

By : Simon Jackson
Book Image

Mastering Unity 2D game development

By: Simon Jackson

Overview of this book

Table of Contents (21 chapters)
Mastering Unity 2D Game Development
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Free Chapter
1
Overview
Index

Backgrounds and active elements


A slightly more advanced option when building game worlds is to add a level of immersive depth to the scene. Having a static image to show the village looks good, especially when you start adding houses and NPCs to the mix; but to really make it shine, you should layer the background and add additional active elements to liven it up.

We won't add them to the sample project at this time, but it is worth experimenting with in your own projects (or try adding it to this one)—it is a worthwhile effect to look into.

Parallaxing

If we look at the 2D sample provided by Unity, the background is split into several panes—each layered on top of one another and each moving at a different speed when the player moves around. There are also other elements such as clouds, birds, buses, and taxis driving/flying around, as shown in the following screenshot:

Implementing these effects is very easy technically. You just need to have the art assets available. There are several scripts...