100% found this document useful (2 votes)
27 views

(Ebook PDF) Unity 2017 2D game development projects create three interactive and engaging 2D games and Unity 2017 1st edition by Lauren Ferro, Francesco Sapio 1786460270 978-1786460271 full chapters - The full ebook set is available with all chapters for download

The document provides access to various ebooks focused on Unity game development, including titles like 'Unity 2017 2D Game Development Projects' and 'Unity 2017 Mobile Game Development.' It offers instant downloads in multiple formats and highlights the expertise of the authors involved. Additionally, it outlines the structure of the book, including chapters on game design, asset management, and user interface development.

Uploaded by

marzolthiti
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
27 views

(Ebook PDF) Unity 2017 2D game development projects create three interactive and engaging 2D games and Unity 2017 1st edition by Lauren Ferro, Francesco Sapio 1786460270 978-1786460271 full chapters - The full ebook set is available with all chapters for download

The document provides access to various ebooks focused on Unity game development, including titles like 'Unity 2017 2D Game Development Projects' and 'Unity 2017 Mobile Game Development.' It offers instant downloads in multiple formats and highlights the expertise of the authors involved. Additionally, it outlines the structure of the book, including chapters on game design, asset management, and user interface development.

Uploaded by

marzolthiti
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 88

Instant Ebook Access, One Click Away – Begin at ebookball.

com

(Ebook PDF) Unity 2017 2D game development


projects create three interactive and engaging 2D
games and Unity 2017 1st edition by Lauren Ferro,
Francesco Sapio 1786460270 978-1786460271 full
chapters
https://ebookball.com/product/ebook-pdf-unity-2017-2d-game-
development-projects-create-three-interactive-and-
engaging-2d-games-and-unity-2017-1st-edition-by-lauren-
ferro-francesco-sapio-1786460270-978-1786460271-full-
chapters-2266/

OR CLICK BUTTON

DOWLOAD EBOOK

Get Instant Ebook Downloads – Browse at https://ebookball.com


Your digital treasures (PDF, ePub, MOBI) await
Download instantly and pick your perfect format...

Read anywhere, anytime, on any device!

(EBook PDF) Unity 2D Game Development Cookbook Over 50


hands on recipes that leverage the features of Unity to
help you create 2D games and game prototypes 1st edition
by Scolastici Claudio 9781783553600 full chapters

https://ebookball.com/product/ebook-pdf-unity-2d-game-development-
cookbook-over-50-hands-on-recipes-that-leverage-the-features-of-unity-
to-help-you-create-2d-games-and-game-prototypes-1st-edition-by-
scolastici-claudio-978178355360/
ebookball.com

(Ebook PDF) Mastering Unity 2017 Game Development and C


Create professional games and solid gameplay features and
professional 2nd edition by Alan Thorn 1788398394
9781788398398 full chapters

https://ebookball.com/product/ebook-pdf-mastering-unity-2017-game-
development-and-c-create-professional-games-and-solid-gameplay-
features-and-professional-2nd-edition-by-alan-
thorn-1788398394-9781788398398-full-chapters-22602/
ebookball.com

(Ebook PDF) Unity 2017 Mobile Game Development Build


deploy and monetize games for Android and iOS with Unity
1st edition by John Doran 1787286770 9781787286771 full
chapters

https://ebookball.com/product/ebook-pdf-unity-2017-mobile-game-
development-build-deploy-and-monetize-games-for-android-and-ios-with-
unity-1st-edition-by-john-doran-1787286770-9781787286771-full-
chapters-22670/
ebookball.com

(Ebook PDF) Learn Unity 2017 for iOS Game Development


Create Amazing 3D Games for iPhone and iPad 2nd edition by
Allan Fowler, Philip Chu 1484231740 9781484231746 full
chapters

https://ebookball.com/product/ebook-pdf-learn-unity-2017-for-ios-game-
development-create-amazing-3d-games-for-iphone-and-ipad-2nd-edition-
by-allan-fowler-philip-chu-1484231740-9781484231746-full-
chapters-22692/
ebookball.com
(Ebook PDF) Unity 2018 By Example Learn about game and
virtual reality development by creating five engaging
projects 2nd Edition by Alan Thorn 1788479327
9781788479325 full chapters

https://ebookball.com/product/ebook-pdf-unity-2018-by-example-learn-
about-game-and-virtual-reality-development-by-creating-five-engaging-
projects-2nd-edition-by-alan-thorn-1788479327-9781788479325-full-
chapters-22598/
ebookball.com

(Ebook PDF) Hands On Unity 2020 Game Development Build


customize and optimize professional games using Unity 2020
and C# 1st edition by Nicolas Alejandro Borromeo
1838647600 9781838647605 full chapters

https://ebookball.com/product/ebook-pdf-hands-on-unity-2020-game-
development-build-customize-and-optimize-professional-games-using-
unity-2020-and-c-1st-edition-by-nicolas-alejandro-
borromeo-1838647600-9781838647605-full-chapters-2/
ebookball.com

(Ebook PDF) 2D iOS and tvOS Games by Tutorials Beginning


2D iOS and tvOS Game Development & Swift 2 1st edition by
Mike Berg, Michael Briscoe, Ali Hafizji
1942878141Â 978-1942878148 full chapters

https://ebookball.com/product/ebook-pdf-2d-ios-and-tvos-games-by-
tutorials-beginning-2d-ios-and-tvos-game-development-swift-2-1st-
edition-by-mike-berg-michael-briscoe-ali-
hafizji-1942878141-978-1942878148-full-chapters-22604/
ebookball.com

(Ebook PDF) Practical Game Development With Unity and


Blender 1st edition by Alan Thorn B012HUEULU full chapters

https://ebookball.com/product/ebook-pdf-practical-game-development-
with-unity-and-blender-1st-edition-by-alan-thorn-b012hueulu-full-
chapters-22694/

ebookball.com

(Ebook PDF) Learn Unity for Android Game Development A


Guide to Game Design, Development and Marketing 1st
edition by Adam Sinicki 1484227042 9781484227046 full
chapters

https://ebookball.com/product/ebook-pdf-learn-unity-for-android-game-
development-a-guide-to-game-design-development-and-marketing-1st-
edition-by-adam-sinicki-1484227042-9781484227046-full-chapters-22696/

ebookball.com
Unity 2017 2D Game
Development Projects

Create three interactive and engaging 2D games with Unity


2017

Lauren S. Ferro

Francesco Sapio

BIRMINGHAM - MUMBAI
Unity 2017 2D Game Development Projects
Copyright © 2018 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form
or by any means, without the prior written permission of the publisher, except in the case of brief quotations
embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the information presented.
However, the information contained in this book is sold without warranty, either express or implied. Neither the
authors, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to
have been caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies and products
mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy
of this information.

Commissioning Editor: Amarabha Banerjee


Acquisition Editor: Larissa Pinto
Content Development Editor: Mohammed Yusuf Imaratwale
Technical Editor: Shweta Jadhav
Copy Editor: Safis Editing
Project Coordinator: Hardik Bhinde
Proofreader: Safis Editing
Indexer: Tejal Daruwale Soni
Graphics: Jason Monterio
Production Coordinator: Aparna Bhagat

First published: January 2018

Production reference: 1180118

Published by Packt Publishing Ltd.


Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.

ISBN 978-1-78646-027-1

www.packtpub.com
mapt.io

Mapt is an online digital library that gives you full access to over 5,000 books and videos, as
well as industry leading tools to help you plan your personal development and advance
your career. For more information, please visit our website.

Why subscribe?
Spend less time learning and more time coding with practical eBooks and Videos
from over 4,000 industry professionals

Improve your learning with Skill Plans built especially for you

Get a free eBook or video every month

Mapt is fully searchable

Copy and paste, print, and bookmark content

PacktPub.com
Did you know that Packt offers eBook versions of every book published, with PDF and
ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a
print book customer, you are entitled to a discount on the eBook copy. Get in touch with us
at [email protected] for more details.

At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a
range of free newsletters, and receive exclusive discounts and offers on Packt books and
eBooks.
Contributors

About the authors


Lauren S. Ferro has a PhD in player modeling. She works as a gamification consultant and
designer in many different industries. She is an active researcher in user-/player-
centered design. Lauren runs game workshops that focus on designing user-
centered gaming experiences. She is also the creator of a game design resource, Gamicards,
which is a prototyping tool for game experiences. She is passionate about the future of
games, their technologies, and their potential to improve people's lives.

Packt Publishing - For the opportunity to write this book and be a part of the authoring
community.
Francesco Sapio - For your help and guidance throughout this book.
Andreas Oehlke - For your time, comments, and suggestions.
My family - For their motivation and encouragement.
You, the reader - I hope that this book takes you on marvelous and intrepid adventures.

Francesco Sapio has a Master's of Science, summa cum laude in engineering with a focus on
AI and Robotics. Now, he is a PhD researcher.

He is a Unity and Unreal expert. Among many projects, he has developed Gea2 (Sapienza)
and Sticker Book (Dataware Games), and has consulted for Prosperity – Italy 1434
(Entertainment Game Apps, Inc) and Projekt I.D (RMIT).

He is an active writer on game development, authoring Getting Started with Unity 5.x 2D
Game Development, Unity UI Cookbook, and many other books.

Finally, Francesco loves math, philosophy, logic, puzzle solving, and, most importantly,
creating video games.

I'm deeply thankful to my family for their enthusiasm and support throughout my life;
they have always encouraged me to do better, using the Latin expressions "Ad maiora" and
"Per aspera ad astra" as motivation.
I'm glad to have worked with Lauren Ferro; it has been a pleasure.
Finally, a huge thanks to all the special people around me whom I love, in particular to my
girlfriend; I’m grateful for all of your help with everything.
About the reviewer
Andreas Oehlke is a professional software engineer and computer scientist who feels very
much at home on any Linux/UNIX machine. He holds a bachelor's degree in computer
science and loves to assemble and disassemble both software and hardware. His trademark
has always been his enthusiasm and affinity for electronics and computers. His hobbies
include game and web development, programming in general (software design and new
languages), programming embedded systems with microcontrollers, sports, and making
music.

He currently works full-time as a senior software engineer for a German financial


institution. Furthermore, and has worked as a consultant and game developer in San
Francisco, CA. He is also the author of the book Learning LibGDX Game Development. In his
spare time, he shares his expertise with a German start-up called Gamerald.

Packt is searching for authors like you


If you're interested in becoming an author for Packt, please visit authors.packtpub.com and
apply today. We have worked with thousands of developers and tech professionals, just
like you, to help them share their insight with the global tech community. You can make a
general application, apply for a specific hot topic that we are recruiting an author for, or
submit your own idea.
Table of Contents
Preface 1
Chapter 1: Press Start 6
Atoms of games 7
Different approaches to games 8
The game design process 9
Workflow 9
Concept development 10
Design and prototyping 11
Implementation 12
Testing 12
Iteration 13
Finalizing 13
A-Team 13
Developing 2D games 14
X, Y, and Z-axis 15
Full 3D 15
Orthographic (3D) 16
2D with 3D graphics, also known as 2.5D 17
Full 2D 18
2D with a perspective camera 20
The Unity Engine 21
Downloading Unity 21
An overview of built-in features in Unity 24
Creating a new 2D project in Unity 25
A brief overview of the Unity User Interface (UI) 26
The main components of the UI in Unity 27
Hierarchy Window 27
Scene View 29
Game View 30
Inspector window 30
Console window 32
Project Window 33
Customizing the workspace 33
Hotkeys to keep in mind 36
Primitive and placeholder objects 37
Images 38
3D model files 39
Meshes and animations 39
Table of Contents

Audio files 40
Naming conventions for assets (and in general) 40
Importing into Unity 40
Special folders 40
Assets 41
Editor 42
Editor default resources 43
Plugins 43
Gizmos 44
Standard Assets 45
StreamingAssets folder 47
Resources 47
Hidden Assets 48
Preparing for the projects in this book 48
Project 1 - Angel Cakes 48
Project 2 - intergalactic shooter: Quark 49
Project 3 - RETROformer 49
Summary 49
Chapter 2: Working with Assets 50
An overview of collecting games 52
Key features of collecting in games and things to keep in mind 53
What will you learn in the remainder of this chapter? 53
Textures and Sprites 54
Sprite Render 55
Sprite Editor 55
How to use the Sprite Editor 55
Sprite Packer 58
Sprite Creator is your friend when you have no assets 59
Setting up the Angel Cakes project 64
Folder setup 66
Importing assets into the engine 66
Configuring assets for the game 67
9-slicing Sprites 76
Best practices 84
Textures 84
Maximizing the space that you have 85
Scaling 85
Naming 86
Summary 86
Chapter 3: Let’s Make Some Prefabs 87

[ ii ]
Table of Contents

Basics of audio and sound FX in Unity 88


Importing audio 90
Audio Listener 90
Audio Source 91
Choosing sounds for background and FX 92
Happy 93
Sad 93
Retro 93
Integrating background music in our game 94
Creating the Angel and the PlayerController 95
A brief overview of Unity's physics system 96
Rigidbody 96
Colliders 97
Assembling the Angel 98
Tagging the player 99
Creating the Script 100
Enforcing components 101
Exposing variables in the inspector 102
From the player input to a new position in the world 104
Moving the character to the new position 105
Testing the PlayerController 106
Collectable system 106
Setting up the Angel Cakes 106
Enforcing components, again! 108
Triggering cake 109
Testing the cake collectable system so far 111
Prefabs for our Game Objects 112
Creating the Prefab for the player and the cake 112
Building the Map 113
Summary 116
Chapter 4: It’s about U and I 117
Overview of the UI 118
Designing the user interface 119
Programming the user interface 120
Four types of UI 121
Diegetic 122
Non-diegetic 123
Spatial 124
Meta 124

[ iii ]
Table of Contents

Usability and function 125


UI is not UX 126
Designing UIs for games 126
Feedback 126
Be bold, not ambiguous 128
Keep it simple, consistent, and focused 130
Ergonomics: devices, hardware, and gestures 130
Multi-device design 130
Meaning and integrity 131
Goals 131
Enjoyment 131
Test 131
Introduction to the UI system in Unity 131
Building UIs in Angel Cakes 132
Scripting a UI and integrating with the collection systems 132
Setting up the UI 133
Programming the scoring system 136
Increasing the score when the player collects a cake 137
Creating a Game Over Screen 138
Scripting the Game Over Screen 139
Last tweaks 140
Testing 141
More kinds of cakes 141
Adding more levels 142
Adding animations 142
Devils 143
Summary 143
Chapter 5: Freeze! Creating an Intergalactic Shooter 145
An overview of game #2 146
Overview of shooting games 147
First-Person 147
Third-Person 148
Top-down 148
Designing game #2 149
Setting up the project for game #2 150
Importing assets for the space shooter 150
Organizing the project 151
Introduction to the animation system 152
Concepts of Sprite animations 153

[ iv ]
Table of Contents

Generating the animations from the sprites 156


Adding a state behavior for destroying the explosion 158
Saving the explosion as a prefab 161
Summary 161
Chapter 6: No One Is Alone Forever 162
Creating a shooting system 163
Player controller 163
Requirements of the player controller 163
Creating the script 164
Moving the player 165
It's time to shoot 167
That explosion was bad 168
Testing the explosion 169
Enemy controller 171
Requirements of the enemy controller 171
Creating the enemy controller 171
New variables for the enemy controller 172
Modifying the movement 172
Shooting deadly bullets 174
Alternative enemy controller 174
Creating the second enemy controller 175
Changing the aiming system 175
Shooting with passion 176
Creating a bullet prefab 177
Creating a bullet controller 178
Enforcing components 178
Exposing variables in the Inspector 178
Getting the reference to the rigidbody 179
Auto-destroying the bullet 180
Moving the bullet 180
Hit spaceships 181
Exercises 182
Summary 183
Chapter 7: Getting Serious About Gameplay 184
Building the UI 185
Setting up the UI 185
Creating the lives counter 187
Creating the star score counter 191
Building an infinite scrolling map 192

[v]
Table of Contents

Repeating the background 192


Falling stars and planets 195
Rotating satellites 196
Creating the prefabs 197
Including power-ups 197
Spawning system 199
Coroutines 199
Creating spawning points 199
Scripting the spawning system 200
Testing the game 203
Exercises 203
Other things you could consider adding to the game 205
Timer 205
Increase the speed 205
Combos 205
Bosses and waves 205
Summary 206
Chapter 8: Building a Tilemap and Importing it into Unity 207
Platforming games 207
Side-scrolling 208
Infinite scrolling/endless runner 208
Overview of the project for game #3 - RETROformer 208
Creating tiles 209
Introduction to the program - Tiled and Tiled2Unity 209
Mini-map 222
Changing level properties 222
Adding colliders to our tiles 224
Importing tilesets into Unity with Tiled2Unity 225
Post-Tiled2Unity 228
Summary 229
Chapter 9: Look, It Moves 230
Advanced animations 231
A short recap of the animation system 231
Setting up the sprite sheet for the animations 233
Creating the animations from the sprite sheet 237
Building the Animation State Machine 238
Summary 245
Chapter 10: Let’s Get Physical 246

[ vi ]
Table of Contents

Physics Material 2D 247


Building the panda hero 252
Moving the panda 259
The control scheme 259
The Movement Component 260
Setting up the Movement Component 265
Player Controller 265
Summary 267
Chapter 11: Don’t Forget to Save! 268
Save and load systems 268
Creating a save/load system in Unity 269
PlayerPrefs 270
PlayerPrefs functions 271
Variables to save in RETROformer 272
Building the save/load system for our game 273
Refining the save and load system 276
Jump pads 277
Creating the Jump Pad 277
Wrapping up gameplay 281
Creating the user interface 281
Water zones 282
Winning zone 286
Enhancing the environment 287
Testing 289
Summary 289
Chapter 12: The Nature of Export 290
Implementing mobile input for the game 290
MovingController 291
JumpController 294
Exporting the game 296
For Android 298
Preparing an Android Unity project 299
Summary 306
Other Books You May Enjoy 307
Index 310

[ vii ]
Preface
Welcome to the world of 2D game development in Unity. In this book, we will explore how
to use the powerful 2D features of the Unity engine to create three amazing games. You will
learn many different skills throughout this book. Not only will these skills be applied to the
games within this book, but they will provide you with a foundation for developing your
own games.

With this said, let's get started!

Who this book is for


This is a book for game developers interested in building stunning 2D games from scratch.
You will need to have a basic familiarity with game development techniques to get the most
out of this book. However, no prior knowledge of Unity is expected or required, although
having some programming skills, especially with C#, is preferable.

What this book covers


Chapter 1, Press Start, is our first chapter and will provide you with a primer about what
game design and development are involved. This chapter offers an overview of the three
different games that will be made throughout the book.

Chapter 2, Working with Assets, will get you started with Unity. This chapter begins with
our first game—Angel's Cakes—and continues by explaining the importation of assets so
that you can set up the foundations of the game (and others) within the book.

Chapter 3, Let's Make Some Prefabs, continues the development of our first game by
introducing fundamental concepts in Unity. It also explains how to start scripting with C#
to create most of the gameplay of this first project.

Chapter 4, It's about U and I, wraps up the first game of the book, and will guide you
through understanding User Interfaces (UIs) in Unity.

Chapter 5, Freeze! Creating an Intergalactic Shooter, marks the beginning of the second game
of this book, which, as the title suggests, will take place in outer space. This chapter will also
introduce the animation system of Unity.
Preface

Chapter 6, No One Is Alone Forever, is all about adding a bit more substance to our shooter
by integrating AI enemies into the rest of the game.

Chapter 7, Getting Serious About Gameplay, further iterates on the second game by
implementing other core game mechanics as well as various suggestions and explanations
on how to improve it.

Chapter 8, Building a Tilemap and Importing It into Unity, introduces a third-party tool for
creating tilesets. Furthermore, you will learn how to incorporate these tiles into Unity to
build 2D worlds for your third game.

Chapter 9, Look, It Moves, starts the actual development of the third and last game of this
book by expanding the concepts learned for animation state machines and extending them
for the main hero animation system.

Chapter 10, Let's Get Physical, focuses on some concepts of Physics 2D in Unity, and how
these can be helpful to finish up the gameplay of the third game, in particular, to create a
movement system that will work on both desktop computers and mobile devices.

Chapter 11, Don't Forget to Save!, outlines how to permanently store the data of your
games, and how to use these techniques to create a save/load system.

Chapter 12, The Nature of Export, dives into how to export the games you made, especially
the third one, to be played either as a standalone (Windows, Linux, or Mac) or on mobile
devices, such as Android.

To get the most out of this book


In order to get the most out of this book, it's preferable that you have had some experience
with some programming languages (specifically C#). Although this book will teach you
how to script in Unity, this is not a programming book. In saying that, this book does not
assume that you have any prior knowledge of Unity, scripting, or the other free programs
that we will use (in Chapter 8, Building a Tilemap and Importing It into Unity). As a result, I
highly recommend that you jump into the first chapter and start exploring the book. In fact,
you can always revise sections of this book once you have developed your skills and
understanding.

[2]
Preface

Download the example code files


You can download the example code files for this book from your account at
www.packtpub.com. If you purchased this book elsewhere, you can visit
www.packtpub.com/support and register to have the files emailed directly to you.

You can download the code files by following these steps:

1. Log in or register at www.packtpub.com.


2. Select the SUPPORT tab.
3. Click on Code Downloads & Errata.
4. Enter the name of the book in the Search box and follow the onscreen
instructions.

Once the file is downloaded, please make sure that you unzip or extract the folder using the
latest version of:

WinRAR/7-Zip for Windows


Zipeg/iZip/UnRarX for Mac
7-Zip/PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https:/​/​github.​com/
PacktPublishing/​Unity-​2017-​2D-​Game-​Development-​Projects. We also have other code
bundles from our rich catalog of books and videos available at https:/​/​github.​com/
PacktPublishing/​. Check them out!

Download the color images


We also provide a PDF file that has color images of the screenshots/diagrams used in this
book. You can download it here: http:/​/​www.​packtpub.​com/​sites/​default/​files/
downloads/​Unity20172DGameDevelopmentProjects_​ColorImages.​pdf.

Conventions used
There are a number of text conventions used throughout this book.

CodeInText: Indicates code words in text, database table names, folder names, filenames,
file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an
example: "Increase the cakesCollected variable every time the player collects a cake."

[3]
Preface

A block of code is set as follows:


void FixedUpdate () {
//Get the new position of our character
var x = transform.position.x + Input.GetAxis("Horizontal") *
Time.deltaTime * speed;
var y = transform.position.y + Input.GetAxis("Vertical") *
Time.deltaTime * speed;
}

When we wish to draw your attention to a particular part of a code block, the relevant lines
or items are set in bold:
void Start() {
rigidBody = GetComponent<Rigidbody2D>();
}

Bold: Indicates a new term, an important word, or words that you see onscreen. For
example, words in menus or dialog boxes appear in the text like this. Here is an example:
"Select System info from the Administration panel."

Warnings or important notes appear like this.

Tips and tricks appear like this.

Get in touch
Feedback from our readers is always welcome.

General feedback: Email [email protected] and mention the book title in the
subject of your message. If you have questions about any aspect of this book, please email
us at [email protected].

[4]
Preface

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes
do happen. If you have found a mistake in this book, we would be grateful if you would
report this to us. Please visit www.packtpub.com/submit-errata, selecting your book,
clicking on the Errata Submission Form link, and entering the details.

Piracy: If you come across any illegal copies of our works in any form on the Internet, we
would be grateful if you would provide us with the location address or website name.
Please contact us at [email protected] with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in
and you are interested in either writing or contributing to a book, please visit
authors.packtpub.com.

Reviews
Please leave a review. Once you have read and used this book, why not leave a review on
the site that you purchased it from? Potential readers can then see and use your unbiased
opinion to make purchase decisions, we at Packt can understand what you think about our
products, and our authors can see your feedback on their book. Thank you!

For more information about Packt, please visit packtpub.com.

[5]
Press Start
1
Welcome. You are at the beginning of your journey into the world of 2D game
development. Throughout this book, we will explore many things that the world of 2D
games can offer and how to design exciting adventures. This book not only explains what to
do in Unity but also what is involved in the game design process. In this way, you will have
a solid foundation in game design and development.

In some instances throughout this chapter and the rest of the book, there are various links to
resources (such as Unity documentation). In many of these instances, both the link and a QR
code are provided. The intention here is to save time entering the URL into your browser if
you are reading a hard copy of this book. Now with that said, this is what we will cover in
this chapter:

Game design
The game design process
Developing 2D games
Unity Engine
Creating new projects in Unity
Preparing for the projects in this book
Key tips and best practices for 2D (and general) game development
Additional game design exercises to develop your skills as a game designer

By the end of this chapter, you will have achieved the following:

Have a general understanding of game design and the processes involved in


making a game
Know how to download and set up Unity
Press Start Chapter 1

Know how to configure Unity for a 2D game project

Now, let's begin our journey.

Game design is an exciting adventure that draws from many different disciplines, such as
programming, art, design, audio, and creative writing. This may be overwhelming,
especially if you're new to game design. You may think "but I am neither a programmer nor
a creative writer, and I can't draw to save my life!" If you have a passion for games, then
game design is possible. However, it is not for the weary. Game design will challenge you
and it will test your patience. However, I promise you that the feeling you get from learning
how to make your first character move with text in a script, to having that character collect
coins, shoot enemies, and finish a level is an extremely rewarding experience.

This book does not assume that you know anything about creating games or any of the
skills that are associated with game development. Over the course of the book, you will
learn the basics of programming in C#, how to create three different types of 2D games in
Unity, and a whole lot more about the game design process in general. Fear not about the
art or the sound, as we will be using some free asset packages and sounds so that you can
create something magical. Of course, if you dare to push yourself, I encourage you to
dabble in these areas, as even a basic level of understanding goes a long way.

Atoms of games
We can think of game designers like chemists, except chemists that create mixtures of
entertainment, emotionally driven narratives, and exciting experiences. If you think back to
chemistry in high school, we all learned that some things make smoke, other things make
bubbles, and a few things when combined make explosions; games work in a similar way,
just with different substances (for example, game elements and mechanics).

When it comes to the distinction between these substances, namely game elements, and
mechanics, there are many interpretations of what they are and what they are made up of.
For the purpose of this book, when a player performs an action, they are likely to get
something. This could range from a Badge, Point(s), Levels, or part of a Story. The "thing"
that the player gets is what we will define as a "game element". Of course, there are many
different examples of and perspectives on what game elements are, but for the purposes of
this book, this will be our definition.

On the other hand, since game elements are the outcome, then the process of how we get
them is what we will define as game mechanics. This could be anything from trading with
other players, exploring mysterious worlds, and even Winning or Losing. Performing or
engaging in these actions will result in obtaining game elements.

[7]
Press Start Chapter 1

When you're playing games, think about things that you are receiving
during gameplay and how you get them. By being a bit more conscious
during your own experiences and reflecting on them, you not only
develop an awareness of the "reactions" that certain game elements and
mechanics afford, it also provides you with a way to consider
implementing these into your own games. As a result, you will learn how
different combinations create different outcomes.

Different approaches to games


Games are enjoyable to play, we play them to entertain ourselves and friends. Over many
decades, as games have developed along with the technologies that make them available,
the context of their uses has also evolved. For example, most games are created to entertain
us (for example, Assassin's Creed). That is, there is no underlying intention, such as to
supplement/support curriculum material or teach us about science (for example, Ludwig) all
the way to operational health and safety. Finally, there are games that have been developed
for entertainment but have ended up being used for more intuitive reasons. This is because
of the educational potential that they afford (for example, Minecraft and Sid Meier's
Civilization series) some games that have been created for entertainment purposes have
provided ways for students to learn and practice various topics. Lastly, there are game-like
experiences or "gamified" experiences that apply game design principles to achieve
everyday tasks, from becoming more productive at work, eating better and maintaining a
healthier lifestyle, to managing finances and developing new skills (for example, Habitica).

If you want to learn all about gamification in Unity, I encourage you to have a
look at Gamification with Unity 5.x. You can get an eBook or hardcopy
version by going to the following link or scanning the QR code: https:/​/​www.
packtpub.​com/​game-​development/​gamification-​unity-​5x.

Now that we have a brief understanding of what games are made of and their use in
different contexts, it's time to understand the game design process.

[8]
Press Start Chapter 1

The game design process


As I mentioned before, there are many things that define what is game design. For example,
it is an opportunity to transport players to realities that we can only imagine to be people
that we may only dream of. However, just as important as what it is and isn't, is how it is
done. Generally speaking there is a systematic approach that game designers follow to
create a game. It begins with the "idea"—the concept of what the game will be. This is
usually not static and will change over the course of a game's development. From there, and
depending on who is on your team, it will go through many design phases before becoming
a prototype. Beyond the prototype phase, the actual game will enter the development
process where the actual assets (and not placeholders) will be created and implemented.
From this point, the game will go through an iterative cycle, where the game will undergo
playtesting, changes, more playtesting, more changes, and then eventually it will be refined
to the point where it will enter the last stages. Here, we will briefly explore each of these
stages.

Workflow
The workflow process of game design is linear in the sense that there is an order that it
takes place: concept development, prototyping, implementation, testing, and hitting
release. This concept is illustrated here:

[9]
Press Start Chapter 1

Of course, the diagram only outlines the process in general. As you develop games and
work with others, you will find that this process loops in many other parts. Sometimes,
through designing and prototyping your concept, you may end up having to change the
initial idea. The important thing to remember is that while to some extent game design is a
linear process, in terms of developmental stages, these stages do and will often form
iterative cycles.

Concept development
We begin the process of game design by first brainstorming and then designing and
prototyping a concept. The ideas at this stage can be adventurous, out there, and completely
bizarre, because anything goes. It may be useful to get yourself a small notebook to write
down your thoughts because they will come to you at any moment. Another thing to think
about is who you are designing this game for. Do you know enough about them or do you
need to do a bit more research? Defining your demographics early on can help when it
comes to refining your idea. For example, if the people you are designing play role-playing
games (RPGs) then they are likely to prefer a detailed narrative and character
customizations, as opposed to premade characters and a simple story. Therefore, the kind of
environment, what kind of narrative that it can afford, and the characters that you will
create (and possible options for them) will need to be thought about while you're
brainstorming ideas.

Some useful tips when it comes to concept development are listed here:

Keep all your ideas in a journal or somewhere safe so that you can refer to them
later.
Challenge yourself if you're stuck with ideas on what kind of game to create.
Choose the first thing that comes to your mind, flip a dictionary and choose a
word at random; there are many ways to really push your creativity.
Play games that you wouldn't normally play, and if you don't play, then start!
By playing more games in different contexts and on different platforms (mobile,
PC, PlayStation, and so on), you will begin to learn how experiences change
depending on the hardware you're using to interact with. Pay attention to how
the player controls differ between a mobile and console game. These little things
will help you later when you start to design and prototype your game.
Deconstruct games, identify the core features, and remake them. At the end of
this chapter, there is a nice exercise for doing this but really think outside of the
box. The aim is to be inventive, to create something new with the same concept.

[ 10 ]
Press Start Chapter 1

Learn about games! Don't just become the game designer, become a researcher,
an explorer of games. Invest a little bit of time to learn what other game designers
have done, how they have done it, what worked or didn't. There are many
postmortem videos about games that explain the development process. In
addition, it also gives you a bit more insight into the overall game design process
and the roles and responsibility that each team member has. In this way, if you're
thinking about creating a small (or large) team, you can understand what's
involved.
Be critical, be judgmental! If you played a game and didn't like, identify why that
was. Was it the controls, perhaps the story was boring? Then take the guise of the
designer, and think about how you would fix it: would you change or remove
something, how would you make it better?

Unfortunately, we won't be covering this stage in the book, as everything


that we will be using in our projects is pre-made. However, what I do
encourage you to do is that after you have learned about the projects that
we will be doing in this book, brainstorm your own version of them.
Instead of Angel Cakes (project 1), develop something that is to do with
zombies or even fish! By doing this, you will be able to practice the first
stage of game development and develop your brainstorming and
conceptualization of game ideas.

Design and prototyping


This is where those crazy ideas become a bit more refined. You begin to weed through all
your ideas, deciding which ones are feasible, which ones are not appropriate for your
intended audiences, and so on. Start with pen and paper and draw out your game. You
don't need to be an artist; prototyping is rough, it's messy, it is completely raw. Don't get
caught up in how neat it looks. The point at this stage is to get what's in your head out on
paper. Other things that you might find useful during the prototyping stage are post-it
notes, colored pens, scissors, dice, counters (for example, beads, buttons, stones, and so on),
other game bits and pieces (for example, Monopoly money, figurines, and so on). During the
prototyping stage, you will want to also see how the interaction flows through the game.
For example, does the interaction feel difficult in the sense you can't do or get something
that you want to? Perhaps the game feels a bit too easy or hard? At this stage, these are
considerations that you will also need to iron out when it comes to properly playtesting
your game, so don't worry too much if they still don't feel completely right.

[ 11 ]
Press Start Chapter 1

Since we won't be actively designing or prototyping the games in this


book, you might want to think about how you would prototype them. One
way to do this is to redesign them with your own ideas and then refine
them through the design and prototype stage so that you can get a better
understanding of this process.

Implementation
This is where you will transfer what you've conceptualized, designed, and prototyped into
the actual game. Generally, this is where you begin integrating it into the game engine,
working on the actual models that will feature in the game. At this point, you're no longer
prototyping, but developing the game. From here on out, you should have a clear idea of
what your game is and how it will work from beginning to end. Once you have begun
implementing your assets into the actual game, you will go through various iterations.
These iterations will often occur after playtesting, albeit informal or formally done (for
example, open/closed alpha, beta testing). The projects in this book will start at this stage.
This is because we already have assets ready for you to use. But it is important to know at
what stage of the game development process that implementation is at.

Testing
This is probably the most important part. If you haven't already been doing this, then I
would suggest that you stop what you're doing and start. Testing is such an important step
in the process because it helps to make sure that your game runs smoothly and efficiently.
Not only this, it can raise issues relating to player engagement, glitches/bugs/exploits within
your game that can give other players an advantage when it comes to game time (especially
in multiplayer games). We will cover playtesting in a later chapter, so we won't go into too
much detail now.

[ 12 ]
Press Start Chapter 1

Iteration
While you're testing, you will also need to iterate your design. Iterations may be minor,
such as the location of objects, others may be large, such as changing the structure of a level
or redoing the animation of a character. At this stage, it's about refining what your game is
to make it what you want it to become. Each iteration is an improvement that will come
with more testing. This is why testing is also very important because, without it, you're not
able to refine and improve, or even fix part of your game, so that it gets to the stage that you
envisioned it at from the beginning. Of course, you will get to a point where you find a
minor change here and another one there, and you may even get caught up in the pursuit of
perfection. All game designers have reached that point, so it's a common feeling of wanting
"completeness" to the point of perfection, but it rarely comes. So when you get to this stage,
you need to let go and move on. Otherwise, you will never complete any game, ever!

Finalizing
This is the polishing stage where you will begin to fine-tune what has already been
implemented. This can include a range of different things from tweaking post-processing
effects to character speeds. This is the final stage before you release your game on your
targeted platform to the public. We will discuss this as we go with each of the three games,
and in the final chapter so that your game will be ready to go.

A-Team
Who you have as part of your team can also impact the overall design and development of
your game. Having the right resources, skill set, and even personalities can have a large
influence on a game's success. Generally, a game development team consists of many
different people: artists, designers, animators, programmers, and sound designers. Each of
these roles will be sub-divided, for instance between character artists, texture artists, level
designers, AI programmers, gameplay programmers, and so on. However, having a range
of different skill sets allows for each part of the game's design to be developed in a
concentrated environment by someone who has experience in the relevant field. However,
not every game is lucky enough to feature an expansive team; you might even be reading
this book without knowing anyone from any of these fields, which is why this book is here
to guide you through the process and to support and expand your knowledge.

[ 13 ]
Press Start Chapter 1

There are many game developers that post information "behind the scenes" of
how their games are developed. These sometimes include commentary and
interviews with various members of their team. A lot of these videos touch on
the challenges that they face during the development of their game and in
some cases the heartache of not being able to complete certain features or the
game at all. I encourage you to check them out. There is one about the Making
of Assassin's Creed Unity you can watch by visiting this link or scanning the
QR code https:/​/​www.​youtube.​com/​watch?​v=​3OjVQBpQSEU:

Developing 2D games
There are some major and subtle differences between 2D and 3D game development, as
well as some misconceptions. Here, we'll go through the most common ones, and touch on
other relevant ones throughout the book. While you don't need a complete understanding
of these differences, the ones here are important to keep in mind if you're new to 2D game
development.

[ 14 ]
Press Start Chapter 1

X, Y, and Z-axis
The first obvious difference between 2D and 3D is that 2D utilizes only two axes: X and Y;
whereas 3D has an additional Z-axis. To explain how this works from a games perspective,
see the following diagram:

Generally speaking, the z-axis is used for depth and is utilized so that the player can
explore an environment like they would in reality whether it is from a third person or first-
person perspective camera. The z-axis allows the added third dimension to an environment.
2.5D games utilize the z-axis to provide a sense of depth because the game is still fixed to
the x and y-axes.

In saying that, it is important to know the differences between 2D, 2.5D, and 3D games.
While there are many different stories, quests, and adventures that games can take us on,
these experiences, at least in terms of their appearance and design, will differ depending on
what axis they are using—x, y, or z. Before we start creating any game in this book, we'll
just briefly go through some examples of 3D and various types of 2D style games. In this
way, you will learn about the differences between the two and what types of experiences
that they can afford.

Full 3D
These games are everything from Assassin's Creed (featured in the following screenshot to
Skyrim and everything in between. They are completely 3D immersive, explorable, and
interactable environments. When you think about the design of a 3D game, you need to
think about what the physical environment will look like. What kind of objects will be in it?
How does the player navigate around them and through the world? For example, think
about where you are right now.

[ 15 ]
Press Start Chapter 1

If you had to turn your current environment into one that would be in a video game, what
kinds of objects would you need to create? Perhaps a desk or chair, maybe a lamp? Then,
how would players interact with these objects? What kind of effects would occur, such as a
player turning the lamp on or off?

There are many basic and intricate details that go into making a 3D environment. Of course,
they are not exclusive to 3D environments, as we will see in the other types of games, but
these are some fundamental considerations.

Screenshot of Assassin's Creed

Orthographic (3D)
Just like the name suggests, orthographic 3D is a 3D game that is played from an
orthographic perspective. Sometimes, these are also referred to as Isometric games and are
given this name because of the perspective that they are played in. Some popular
orthographic games include Diablo, Q*bert, Clash of Clans, and Monument Valley (featured
next).

[ 16 ]
Press Start Chapter 1

Unlike 3D, and depending on the type of gameplay that is required (for example, can the
player rotate the environment?), the player will more than likely not see all sides of the
game environment.

Screenshot of Monument Valley

2D with 3D graphics, also known as 2.5D


Think of 2.5D simply as a 3D environment constrained to a 2D plane (for example, x, y-
axis). In other words, the player can only move up and down, left or right; they are not able
to move on the z-axis. The use of 3D is merely used mostly for an aesthetic purpose, such as
to show the depth of an environment. An example is shown next, with a screenshot taken
from the game New'n'Tasty. In this screenshot, you can see the characters are constricted to
a platform, with various levels (depths) of environmental assets visible in the background.
When designing for 2.5D games, only a portion of the environmental assets are seen, as if
you walked into a room and that is it, you can walk no further.

[ 17 ]
Press Start Chapter 1

There are different practices and approaches to modeling assets for games like this, so I
encourage you to explore them if 2.5D is something that piques your interest. Some other
great examples of 2.5D games are Little Big Planet, Trine, Bastion, and Raymond Origins.

Screenshot of New'n'Tasty

Full 2D
Games that are restricted to the x and y-axis (and don't show any depth) are what we call
2D games, such as Pac Man (featured next). They can be top-down or side-scrolling
(up/down/left/right). Unlike 3D games, players only see one side of the game object at any
given moment. Sometimes this can be quite linear in the sense that there is no perception of
depth (with the exclusion of parallax).

[ 18 ]
Press Start Chapter 1

Often though, sprites can be brought to life, as can the environment, with beautiful (frame-
by-frame) animations and effects. Other popular examples of 2D games are Mario, Donkey
Kong, Space Invaders, Monaco: What's Yours Is Mine, Mark of the Ninja, and Castlevania:
Symphony of the Night.

Screenshot of Pac Man

[ 19 ]
Press Start Chapter 1

2D with a perspective camera


Like 2.5D games, 2D games can also utilize "depth" by using a perspective camera or
utilizing a concept known as parallax, while not having any 3D assets within the
environment. To understand the concept of the parallax effect at a more scientific level, let
us look at the following diagram:

Depending on where you are, certain items are in view instead of others. If a player is at
viewpoint 1, then they will see the black circle and blue hexagon; if they are at viewpoint 2
then they will see the black circle and a red hexagon. Moreover, you can also think of it like
this as well, when you move within a game space, the "background" that is closest to you
moves faster than the "background" that is further away. It is the same when you're driving
in an area, such as the country, and you can see the mountains moving slower than the
fence. There are many games that use 2D with a perspective camera/parallax effect, such
as Braid (featured next).

[ 20 ]
Press Start Chapter 1

Other great examples of 2D games that feature parallax environments include Terraria and
Limbo.

The Unity Engine


You've made it, you've decided you want to learn Unity, good for you! There are a few
things that we need to do before we even open Unity (assuming you haven't downloaded it
or used it before). If you have already downloaded Unity and set it up, you can skip the
next section: An overview of built-in features in Unity; if you haven't please read on.

Downloading Unity
Now, let's start getting everything set up to create our games.

To begin, you can grab your own free copy of Unity by heading to the following
URL: https:/​/​unity3d.​com/​get-​unity/​download.

If you choose to download Unity 2018 Beta, it should not affect anything
that you will do in this book. However, it is possible that some things will
be slightly different than they are presented here. Please keep this in mind
when deciding on which version to download. For this book, we are going
to use the latest stable version at the time of writing.

[ 21 ]
Press Start Chapter 1

Each plan has its own benefits, some with more added features than others. Depending on
your long-term needs, a pro or plus plan might be useful. However, for all the projects in
this book, we will be using the personal (free) version of Unity. Once you have chosen the
version that suits your needs the most, download and install it.

While this book aims to teach you the basics of 2D game development, I
encourage you to check out these four things (all available on the official
website):

1. Tutorials https:/​/​unity3d.​com/​learn/​tutorials
2. Documentation https:/​/​docs.​unity3d.​com/​2017.​3/
Documentation/​Manual/​
3. Community https:/​/​unity3d.​com/​community
4. Social (for example, Twitter, Facebook groups, and so on)

Not only will you be able to explore a lot of the added 2D (and 3D) options
that Unity offers, which aren’t covered here, you can also learn about them
through their own tutorials. Lastly, I highly encourage you to become part
of the Unity Community and engage with their social media. In this way,
you will be able to connect with other Unity game developers while at the
same time being up to date with the latest news and be immersed in a
great platform for you to share your own projects and questions with
other game developers.

Once you have installed Unity, you will be required to log in. If you haven't created an
account, don't fret, it's a straightforward process. Simply click on the create one link to do it.
The process is simple, free, and will take little time to go through. Once you're done, come
back and enter your login details, and click Sign In.

More detailed information can be found here: https:/​/​unity3d.​com/


unity/​activation/​personal or by scanning the following QR code.

[ 22 ]
Press Start Chapter 1

Once you've done this, there will be a short survey about you (basic demographic
information) and your intended use of Unity. This is the final step before we will use Unity.
When you have submitted the survey response, you will see a screen with three different
options: Projects, Learn, and Activity, like this:

Projects simply show all your current projects that are either found on your computer (On
Disk) or online (In the Cloud). However, what I want to draw your attention to is the Learn
tab, which is shown here:

[ 23 ]
Press Start Chapter 1

There are several types of tutorials that you can explore at your own pace, like the ones in
this book, which will teach you some interesting things about Unity. You will need to
download each tutorial to go through it and depending on your connection, it may take a
little to no time. Here is an example of the Survival shooter tutorial, along with the
instructions within the browser (left):

(left) The Survival Shooter tutorial that Unity offers. (right) The tutorial as viewed within Unity itself.

An overview of built-in features in Unity


Unity has some great built-in features. Let's begin by exploring some of the basics. Unity
has many fantastic features, and we don't have enough time to cover them all. However, as
we venture further into this book we will start to cover the fundamental and important
ones. As you progress through the projects, we will begin to cover more advanced features.

[ 24 ]
Press Start Chapter 1

Creating a new 2D project in Unity


To begin a new project within Unity, we first need set up the project files. When you open
Unity, be sure to click on the New icon in the top navigation menu, on the right. Once you
have done this, you will see a screen like this:

Do these things first:

Give your project a unique name, something that isn't too long, but also
descriptive enough.
Next, in this window, we need to specify a location for your project that has
enough space available and isn't going to be modified by other people (other than
team members). This is more the case when it comes to shared workspaces and
networks.
Once you have done that, click on the radio button for 2D as shown in the
preceding screenshot.
Now, click Create Project. We don't need to add any asset packages at this stage
as we will be adding them manually later for each project.

Once you have done this, unity will open the project space, which we will discuss in more
detail in the next section.

[ 25 ]
Press Start Chapter 1

A brief overview of the Unity User Interface (UI)


Unity will begin setting up the project and once it's completed, you will see a screen like
this:

This is an example of the Unity UI once you open Unity. As you can see there are no project files at this stage.

This might be a bit overwhelming if you're new to Unity, but don't worry, you will be up to
speed in no time. We'll go through each part of it in more detail later in this chapter and
throughout the book, starting in the top left corner with Hierarchy, Scene,
Game, Inspector, Console, and finishing in the bottom left corner, with the Project panel.

[ 26 ]
Press Start Chapter 1

The main components of the UI in Unity


These are the main "default" components that you will see. By default, this means they are
here once you launch Unity for the first time or when you reset the workspace; we'll discuss
how to do this later.

Hierarchy Window
The Hierarchy Window contains all of the GameObject within the current Scene. A
GameObject can be anything from a prop or character to the scenery. In essence,
GameObjects are like a container that we can place things into what we refer to Component.
In Unity, Component can be for lighting, animation, character control, rendering, physics,
colliders, and so on. It is these that give GameObject functionality. An example of the
default Hierarchy window is this:

To put it simply, GameObject contain Component, which provides the functionality for
GameObject within a Scene. As we begin to add and remove GameObject from the Scene,
they will appear and disappear from the Hierarchy window as well. In addition, another
handy thing to know is that anything within the Hierarchy window can be parented.
Parenting simply establishes a hierarchy when it comes to the connection between
GameObject. For example, a 3D asset may contain various parts that need to be moved and
scaled together.

[ 27 ]
Press Start Chapter 1

Therefore, the main GameObject becomes a Parent and all the other objects become
Children. You can easily parent and unparent GameObject by simply selecting the main
object and dragging it to where you want it to sit within the hierarchical structure. You can
see this process illustrated here:

Lastly, it is possible to have more than one Scene opened in the Hierarchy window, but we
won't need to do this in the projects in the book. If you would like to know more about it,
head on over to the official Unity documentation by going to this link or scanning the QR
code: https:/​/​docs.​unity3d.​com/​Manual/​MultiSceneEditing.​html

Next, we will look at the "big picture" or the Scene View within Unity.

[ 28 ]
Press Start Chapter 1

Scene View
The Scene View is where all the magic happens. In here is where you will create your
game. You can see this part of the Unity UI, in the following screenshot. This is an
interactive space where you can select, rearrange, and position all the GameObject within
your project. We will cover Scene View navigation and how to move GameObject around
in the next chapters.

[ 29 ]
Press Start Chapter 1

Game View
The Game View is very similar to the Scene View, giving a window into your game. In
particular, the Game View shows which is the final result, what the player will see in your
game. Also, the Game View can simulate different screen ratios. This allows you to control
how your game will look on the different screens on which your game will run. Although
this is a good preview, before a final release, you should still test on as many as real screens
possible to ensure the best quality of your game. This is how it looks in Unity:

Inspector window
The Inspector window is where all the information related to the selected GameObject is
presented. It will become one of the most used windows within the Unity UI. As we have
already discussed, Scenes contain GameObject and these contain Component, and it is in
the Inspector window (like in the following screenshot) that all the information of this
Component is visible. This information relates to the properties and settings of not just
GameObject, but to pretty much everything else within Unity, such as assets, materials,
audio, and so on.

[ 30 ]
Press Start Chapter 1

We will go into more details about properties that are listed within the Inspector window
throughout the book, but for now, this is just an overview of what it does.

To get an idea of how it looks like when an object is selected here is an example of the
Inspector when the default camera is selected:

[ 31 ]
Press Start Chapter 1

Console window
The Console window, which is shown next, shows errors, warnings, and other messages
either generated by Unity or your own game code that relate to various parts of the project.
These messages can be simple syntax errors within code or more problematic issues relating
to performance. We will go into more detail about the different types of errors, how to
resolve common ones, and how to run checks known as Debugging—to check where errors
are occurring, in later chapters.

You will notice these errors as you play a Scene or try to run scripts. Each error will present
itself with a name and a brief description of what the error is, and where it can be found
within the script (for example, line number within a code file). Here is an example of a
simple log:

[ 32 ]
Press Start Chapter 1

Project Window
The Project window will display every file within your project that you have either
imported or created within Unity, such as models, scripts, plugins, and so on. Everything
within your Unity project is (and should be) contained within a folder structure, with the
Assets folder being the root—or parent folder, like in the following screenshot:

When you select a folder within the Project window the contents will be shown in the panel
to the right, like in this screenshot:

In this image, you can see the various Sprites that have been cut from the Sprite Sheet for Angel Cakes.

Customizing the workspace


It is quite easy to customize the layout of the workspace within Unity. There are many
different panels which serve different purposes: the Window menu item in the top bar can
be navigated to open additional panels or panels that have been closed earlier. To change
the layout, move the mouse cursor over the panel's name you want to move and then press
and hold the left mouse button. Holding down, drag the tab where you would like it to be.
It can be a floating (for example, separate window, see the following screenshot) or
anchored to another part of the Unity UI.

[ 33 ]
Press Start Chapter 1

You can see the difference between floating (image on the left) and anchored next to the
Hierarchy tab (image on the right) of the Project panel:

[ 34 ]
Press Start Chapter 1

If you have rearranged the workspace and don't like it, you can reset to Unity's default
layout. To do this, go to Window | Layouts | Revert Factory Settings..., as here:

You will be prompted with a confirmation box, as shown here, click Continue and the
layout will be reset.

From the same menu, It is also possible to save and load custom layouts. By doing this, you
can switch between your favorites layouts when you need to work on different aspects of
your game.

[ 35 ]
Press Start Chapter 1

Hotkeys to keep in mind


We all like to take shortcuts from time to time, and working with Unity, hotkeys can help
make performing simple tasks a whole lot more efficient. Here is a list of useful hotkeys for
actions that you'll perform on a regular basis throughout this book. Feel free to make a copy
of this page or print it to reference later (the list has been taken from the official
documentation of Unity at the following link: https:/​/​docs.​unity3d.​com/​Manual/
UnityHotkeys.​html). Here are the most used ones:

Tools
Keystroke Command
Q Pan
W Move
E Rotate
R Scale
T Rect Tool
Z Pivot Mode toggle
X Pivot Rotation Toggle
V Vertex Snap
Ctrl/command + LMB Snap
GameObject
Ctrl/command + Shift + N New empty game object
Alt + Shift + N New empty child to selected game object
Ctrl/command + Alt + F Move to view
Ctrl/command + Shift + F Align with view
Shift + F or double-F Locks the scene view camera to the selected GameObject

[ 36 ]
Another Random Document on
Scribd Without Any Related Topics
THE IMPRISONMENT OF
PROMETHEUS

I
It was a few days after this that Prometheus, denounced by the
over-zealous waiter, found himself in prison for making matches
without a licence.
The prison was isolated from the rest of the world, and its only
outlook was on to the sky. From the outside it had the appearance of
a tower. In the inside Prometheus was consumed by boredom.

The waiter paid him a visit.


—Oh! said Prometheus smiling, I am so happy to see you! I was
bored to death. Tell me, you who come from outside; the wall of this
dungeon separates me from everything and I know nothing about
other people. What is happening?—And you, first tell me what you
are doing.
—Since your scandal, replied the waiter nothing much; hardly
anybody has been to the restaurant. We have lost a great deal of
time in repairing the window.
—I am greatly distressed, said Prometheus;—but Damocles? Have
you seen Damocles? He left the restaurant so quickly the other day;
I was not able to say good-bye. I am so sorry. He seemed a very
quiet person, well-mannered, and full of scruples; I was touched
when he told me so naturally of his trouble.—I hope when he left the
table he was happier?
—That did not last, said the waiter. I saw him the next day more
uneasy than ever. In talking to me he cried. His greatest anxiety was
the health of Cocles.
—Is he unwell? asked Prometheus.
—Cocles?—Oh no, replied the waiter. I will say more: He sees better
since he sees with only one eye. He shows every one his glass eye,
and is delighted when he is condoled with. When you see him, tell
him that his new eye looks well, and that he wears it gracefully; but
add how he must have suffered....
—He suffers then?
—Yes, perhaps, when people do not sympathize with him.
—But then, if Cocles is well and does not suffer, why is Damocles
anxious?
—Because of that which Cocles should have suffered.
—You advise me then strongly....
—To say it, yes, but Damocles thinks it, and that’s what kills him.
—What else does he do?
—Nothing. This unique occupation wears him out. Between us, he is
a man obsessed.—He says that without those £20 Cocles would not
be miserable.
—And Cocles?
—He says the same.... But he has become rich.
—Really ... how?
—Oh! I do not know exactly;—but he has been talked about in the
papers; and a subscription has been opened in his favour.
—And what does he do with it?
—He is an artful fellow. With the money collected he thinks of
founding a hospital.
—A hospital?
—Yes, a small hospital for the one eyed. He has made himself
director of it.
—Ah bah! cried Prometheus; you interest me enormously.
—I hoped you would be interested, said the waiter.
—And tell me ... the Miglionaire?
—Oh! he, he is a wonderful chap!—If you imagine that all that
upsets him! He is like me: he observes.... If it would amuse you, I
will introduce you to him—when you come out of this....
—Well, by the way, why am I here? Prometheus said at last. What
am I accused of? Do you know, waiter, you seem to know
everything?
—My goodness no, pretended the waiter. All that I know is that it is
only preliminary detention. After they have condemned you, you will
know.
—Well, so much the better! said Prometheus. I always prefer to
know.
—Good-bye, said the waiter; it is late. With you it is astonishing how
the time flies.... But tell me: your eagle? What has become of him?
—Bless me! I have thought no more of him, said Prometheus. But
when the waiter had gone Prometheus began to think of his eagle.

HE MUST INCREASE BUT I MUST DECREASE

And as Prometheus was bored in the evening, he called his eagle.—


The eagle came.
—I have waited a long time for thee, said Prometheus.
Why didst thou not call me before? replied the eagle.
For the first time Prometheus looked at his eagle, casually perched
upon the twisted bars of the dungeon. In the golden light of the
sunset he appeared more spiritless than ever; he was grey, ugly,
stunted, surly, resigned, and miserable; he seemed too feeble to fly,
seeing which Prometheus cried with pity.
—Faithful bird, he said to him, dost thou suffer?—tell me: what is
the matter?
—I am hungry, said the eagle.
—Eat, said Prometheus, uncovering his liver.
The bird ate.
—I suffer, said Prometheus.
But the eagle said nothing more that day.

II
The next day at sunrise Prometheus longed for his eagle; he called it
from the depth of the reddening dawn, and as the sun rose the
eagle appeared. He had three more feathers and Prometheus
sobbed with tenderness.
—How late thou comest, he said, caressing his feathers.
—It is because I cannot yet fly very fast, said the bird. I skim the
ground....
—Why?
—I am so weak!
—What dost thou want to make thee fly faster?
—Thy liver.
—Very well, eat.
The next day the eagle had eight more feathers and a few days after
he arrived before the dawn. Prometheus himself became very thin.
—Tell me of the world, he said to the eagle. What has happened to
all the others?
—Oh! now I fly very high, replied the eagle; I see nothing but the
sky and thee.
His wings had grown slowly bigger.
—Lovely bird, what hast thou to tell me this morning?
—I have carried my hunger through the air.
—Eagle, wilt thou never be less cruel?
—No! But I may become very beautiful.
Prometheus, enamoured of the future beauty of his eagle, gave him
each day more to eat.
One evening the eagle did not leave him.
The next day it was the same.
He fascinated the prisoner by his gnawings; and, the prisoner, who
fascinated him by his caresses, languished and pined away for love,
all day caressing his feathers, sleeping at night beneath his wings,
and feeding him as he desired.—The eagle did not stir night or day.
—Sweet eagle, who would have believed it?
—Believed what?
—That our love could be so charming.
—Ah! Prometheus....
—Tell me, my sweet bird! Why am I shut up here?
—What does that matter to thee? Am I not with thee?
—Yes; it matters little! but art thou pleased with me, beautiful eagle?
—Yes, if thou thinkest I am beautiful.

III
It was spring-time; around the bars of the tower the fragrant
wisteria was in flower.
—One day we will go away, said the eagle.
—Really? cried Prometheus.
—Because I am now very strong and thou art thinner. I can carry
thee.
—Eagle, my eagle!... Take me away.
And the eagle carried him away.

A CHAPTER WHILE WAITING THE NEXT ONE

That evening Cocles and Damocles met each other. They chatted
together; but with a certain embarrassment.
—What can you expect? said Cocles, our points of view are so
opposed.
—Do you think so? replied Damocles. My only desire is that we
understand each other.
—You say that, but you only understand yourself.
—And you, you do not even listen to what I say.
—I know all that you would say.
—Say it then if you know it.
—You pretend to know it better than I do.
—Alas! Cocles, you get cross;—but for the love of God tell me what
ought I to do?
—Ah! nothing more for me, I beg you; you have already given me a
glass eye....
—Glass, in lack of a better, my Cocles.
—Yes—after having half blinded me.
—But it was not I, dear Cocles.
—It was more or less; and in any case you can pay for the eye—
thanks to my blow.
—Cocles! forget the past!...
—No doubt it pleases you to forget.
—That’s not what I mean to say to you.
—But what do you mean to say then? Go on, speak!
—You do not listen to me.
—Because I know all that you would say!...
The discussion, for want of something new began to take a
dangerous turn, when both men were suddenly arrested by an
advertisement which ran as follows:

THIS EVENING AT 8 O’CLOCK


IN THE
HALL OF THE NEW MOONS
PROMETHEUS DELIVERED
WILL SPEAK OF
HIS
EAGLE
At 8.30 the Eagle will be presented and will perform some
tricks. At 9 o’clock a collection will be made by the waiter on
behalf of Cocles’ hospital.

—I must see that, said Cocles.


—I will go with you, said Damocles.

IV
In the Hall of the New Moons, at eight o’clock precisely, the crowd
gathered.
Cocles sat on the left; Damocles on the right; and the rest of the
public in the middle.
A thunder of applause greeted the entry of Prometheus; he mounted
the steps of the platform, placed his eagle at the side of him, and
pulled himself together.
In the hall there was a palpitating silence....

THE PETITIO PRINCIPII

—Gentlemen, began Prometheus, I do not pretend, alas! to interest


you by what I am about to say, so I was careful to bring this eagle
with me. After each tiresome part of my lecture he will play some
tricks. I have also with me some indecent photographs and some
fireworks, with which when I reach the most serious moments of my
lecture I will try to distract the attention of the public. Thus, I dare
to hope, gentlemen, for some attention. At each new head of my
discourse I shall have the honour, gentlemen, to ask you to watch
the eagle eating his dinner,—for, gentlemen, my discourse has three
heads; I did not think it proper to reject this form, which is
agreeable to my classical mind.—This being the exordium, I will tell
you at once and without more ado, the first two heads of the
discourse:
First head: One must have an eagle.
Second head: In any case, we all have one.
Fearing that you will accuse me of prejudice, gentlemen; fearing also
to interfere with my liberty of thought, I have prepared my lecture
only up to that point; the third head will naturally unfold from the
other two. I will let inspiration have all its own way.—As conclusion,
the eagle, gentlemen, will make the collection.
—Bravo! Bravo! cried Cocles.
Prometheus drank a little water. The eagle pirouetted three times
round Prometheus and then bowed. Prometheus looked round the
hall, smiled at Damocles and at Cocles, and as no sign of
restlessness was as yet shown he kept the fireworks for later on,
and continued:

V
—However clever a rhetorician I may be gentlemen, in the presence
of such perspicacious minds as yours I cannot juggle away the
inevitable petitio principii which awaits me at the beginning of this
lecture.
Gentlemen, try as we may, we cannot escape the petitio principii.
Now; what is a petition of principles? Gentlemen, I dare to say it:
Every petitio principii is an affirmation of temperament; for where
principles are missing, there the temperament is affirmed.
When I declare: You must have an eagle you may all exclaim: Why?
—Now, what answer can I make in reply that will not bring us back
to that formula, which is the affirmation of my temperament: I do
not love men: I love that which devours them. Temperament,
gentlemen, is that which must affirm itself. A fresh petitio principii,
you will say. But I have demonstrated that every petitio principii is
an affirmation of temperament; and as I say one must affirm one’s
temperament (for it is important), I repeat: I do not love men: I love
that which devours them.—Now what devours man?—His eagle.
Therefore, gentlemen, one must have an eagle. I think I have fully
demonstrated this.
... Alas! I see, gentlemen, that I bore you; some of you are yawning.
I could, it is true, here make a few jokes; but you would feel them
out of place; I have an irredeemably serious mind.
I prefer to circulate among you some indecent photographs; they
will keep those quiet who are feeling bored, which will enable me to
go on.
Prometheus drank a drop of water. The eagle pirouetted three times
round Prometheus and bowed. Prometheus went on:

CONTINUATION OF PROMETHEUS’ LECTURE

—Gentlemen, I have not always known my eagle. That is what


makes me deduce, by a process of reasoning which the logic books I
never studied till a week ago, call by some particular name I have
forgotten—that is what makes me deduce, I say, that, even though
the only eagle here is mine, you all, gentlemen, have an eagle.
I have said nothing, up to the present, of my own history; firstly
because, up to the present, I have not understood it. And if I decide
to speak of it now it is because, thanks to my eagle, it now appears
to me marvellous.

VI
—Gentlemen, as I have already said, my eagle was not always with
me. Before his time I was unconscious and beautiful, happy and
naked and unaware. Oh! Charming days! On the many-fountained
sides of the Caucasus, lascivious Asia, naked too and unaware, held
me in her arms.
Together we sported, tumbling in the valleys; the air sang, the water
laughed, the simplest flowers were fragrant for our delight. And
often we lay beneath spreading branches, among flowers which
were the haunt of murmuring bees.
Asia wedded me, all laughter and then the murmuring swarms and
the rustling leaves, with which was mingled the music of the
streams, gently lulled us to the sweetest of slumbers. Around us all
consented—all protected our inhuman solitude.—Suddenly one day
Asia said to me: You should interest yourself in men.
I first had to find them.
I was willing enough to interest myself in them—but it was to pity
them.
They lived in such darkness; I invented for them certain kinds of fire,
and from that moment my eagle began. And it is since that day that
I have become aware that I am naked.
At these words, applause arose from various parts of the hall. All of
a sudden Prometheus broke into sobs.
The eagle flapped his wings and cooed.
With an agonizing gesture Prometheus opened his waistcoat and
offered his tortured liver to the bird.
The applause redoubled.
Then the eagle pirouetted three times round Prometheus, who drank
a few drops of water, and continued his lecture in these words:

VII
—Gentlemen, my modesty overcame me. Excuse me, it is the first
time I speak in public. But now it is my sincerity which overcomes
me. Gentlemen, I have been more interested in men than I have
ever admitted. Gentlemen, I have done a great deal for men.
Gentlemen, I have passionately, wildly, and deplorably loved men—
and I have done so much for them—one can almost say that I have
made them; for before, what were they? They existed, but had no
consciousness of existence; I made this consciousness like a fire to
enlighten them, gentlemen; I made it with all the love I bore them.
—The first consciousness they had was that of their beauty. It is this
which caused the propagation of the race. Men were prolonged in
their posterity. The beauty of the first was repeated, equally,
indifferently, uneventfully. It could have lasted a long time.—Then I
grew anxious, for I carried in me already, without knowing it, my
eagle’s egg and I wanted more or better. This propagation, this
piecemeal prolongation, seemed to me to indicate in them an
expectancy—when in reality only my eagle was waiting. I did not
know; that expectancy I thought was in man; that expectancy I put
in man. Besides, having made man in my image, I now understood
that in every man there was something hatching; in each one was
the eagle’s egg.... And then, I do not know; I cannot explain this.—
All that I know is that, not satisfied with giving them consciousness
of existence, I also wished to give them a reason for existence. So I
gave them Fire, flame and all the arts which a flame nourishes. By
warming their minds, I brought forth the devouring faith in progress.
And I was strangely happy when their health was consumed in
producing it. No more belief in good, but the morbid hope for better.
The belief in progress, gentlemen, that was their eagle. Our eagle is
our reason for existence, gentlemen.
Man’s happiness grew less and less—but that was nothing to me:
the eagle was born, gentlemen! I loved men no more, I loved what
fed on them. I had had enough of a humanity without history.... The
history of man is the history of their eagles, gentlemen.

VIII
Applause broke out here and there. Prometheus, abashed, excused
himself:
—Gentlemen, I was lying: pardon me: it did not happen quite so
quickly: No, I have not always loved eagles: For a long time I
preferred men; their injured happiness was dear to me, because
once having interfered I believed myself responsible, and in the
evening every time I thought of it, my eagle, sad as remorse, came
to eat.
He was at this time gaunt and grey, careworn and morose, and he
was as ugly as a vulture.—Gentlemen, look at him now and
understand why I tell you this; why I asked you to come here; why I
entreat you to listen to me. It is because I have discovered this: the
eagle can become very beautiful. Now, every one of us has an
eagle; as I have just most earnestly asserted. An eagle?—Alas, a
vulture perhaps! no, no, not a vulture, gentlemen!—Gentlemen, you
must have an eagle....

And now I touch the most serious question:—Why an eagle?... Ah!


Why?—let him say why. Here is mine, gentlemen; I bring him to
you.... Eagle! Will you reply now? Anxiously Prometheus turned
towards his eagle. The eagle was motionless and remained silent....
Prometheus continued in a distressed voice:
—Gentlemen, gentlemen, I have vainly questioned my eagle....
Eagle! speak now: every one listens to you.... Who sends you? Why
have you chosen me? Where do you come from? Where do you go
to? Speak: What is your nature? (The eagle remained silent.) No,
nothing! Not a word! Not a cry!—I hoped he would speak to you at
any rate; that is why I brought him with me.... Must I speak alone
here?—All is silence!—All is silence!
What does it mean?... I have questioned in vain. Then turning
towards the audience:
Oh! I hoped, gentlemen, that you would love my eagle, that your
love would affirm his beauty.—That is why I gave myself up to him,
that is why I filled him with the blood of my soul.... But I see I am
alone in admiring him. Is it not enough for you that he is beautiful?
Or do you not admit his beauty? Look at him at least. I have lived
only for him—and now I bring him to you: There he is! As for me I
live for him—but he ... but he, why does he live?
Eagle that I have nourished with the blood of my soul, whom with all
my love I have caressed ... (here Prometheus was interrupted by
sobs)—must I then leave the earth without knowing why I loved
you, nor what you will do, nor what you will be, after me on the
earth ... on the earth? I have ... asked in vain ... in vain....
The words choked in his throat—his voice could not be heard
through his tears.—Pardon me, gentlemen,—he continued a little
calmer; pardon me for saying such serious things, but if I knew
more serious ones I would say them....
Perspiring, Prometheus wiped his face, drank some water, and
added:

THE END OF PROMETHEUS’ LECTURE

—I have only prepared my lecture up to this point....


... At these words there was a rustling among the audience; several,
feeling bored, wished to go out.
—Gentlemen, cried Prometheus, I beseech you to stay, it will not be
very long now; but the most important thing of all remains to be
said, if I have not already persuaded you.... Gentlemen!—for
goodness’ sake.... Here! quickly: a few fireworks; I will keep the best
for the end.... Gentlemen!—sit down again, I pray you; look: do not
think I want to economize: I light six at a time.—But first, waiter,
shut the doors.
The fireworks were more or less effective. Nearly every one sat
down again.
—But where was I? cried Prometheus. I counted upon getting under
weigh; disturbance has checked me.
—So much the better, cried some one.
—Ah! I know ... continued Prometheus. I wished to tell you again....
—Enough! enough!! cried voices from all parts of the hall.
... That you must love your eagle.
Several cried “Why?” ironically.
—I hear, gentlemen, some one asks me “Why?” I reply: Because
then he will become beautiful.
—But if we become ugly?
—Gentlemen, I do not speak here words of self-interest....
—One can see that.
—They are words of self-devotion. Gentlemen, one must devote
oneself to one’s eagle.... (Agitation—many get up.) Gentlemen, do
not move: I will be personal. It is not necessary to remind you of the
history of Cocles and Damocles.—All here know it. Well—Well! I will
tell them to their faces: the secret of their lives is in their self-
devotion to their debt: You, Cocles, to your blow; you, Damocles, to
your bank-note. Cocles, your duty was to make your scar deeper and
your empty orbit emptier, oh! Cocles! yours, Damocles, to keep your
bank-note, to continue owing it, owing it without shame, owing even
more, owing it with joy. There is your eagle; there are other and
more glorious ones. But I tell you this: the eagle will devour us
anyway—vice or virtue—duty or passion,—cease to be commonplace
and you cannot escape it. But....
(Here the voice of Prometheus was barely heard in the tumult)—but
if you do not feed your eagle lovingly he will remain grey and
miserable, invisible to all and sly; then you will call him conscience,
not worthy of the torments he causes; without beauty.—Gentlemen,
you must love your eagle, love him to make him beautiful; for it is
for his future beauty that you must love your eagle....
Now I have finished, gentlemen, my eagle will make the collection.
Gentlemen, you must love my eagle.—In the meantime I will let off
some fireworks....

Thanks to the pyrotechnic diversion, the assembly dispersed without


too much trouble; but Damocles took cold on coming out of the hall.
THE ILLNESS OF DAMOCLES

I
—You know that he is not at all well, said the waiter, seeing
Prometheus a few days later.
—Who?
—Damocles—Oh! very bad:—it was coming out after your lecture
that he was taken ill....
—But what is the matter?
—The doctors hesitate;—it is a very unusual illness ... a shrinkage of
the spine....
—The spine?
—Yes, the spine.—At least, unless a miracle happens he must get
worse. He is very low, I assure you, and you should go and see him.
—You go very often yourself?
—I? Yes, every day.—He is very anxious about Cocles; I bring him
news every day.
—Why doesn’t Cocles go to see him himself?
—Cocles?—He is too busy. Don’t you remember your lecture? It has
made an extraordinary effect upon him. He talks of nothing but self-
devotion, and passes all his time looking in the streets for another
blow, which may benefit some unknown Damocles. In vain he offers
his other cheek.
—Why not tell the Miglionaire?
—I give him news every day. That is really the reason why I visit
Damocles every day.
—Why does he not go and see Damocles himself?
—That is what I tell him, but he refuses. He does not wish to be
known. And yet Damocles would certainly get well immediately if he
knew his benefactor. I tell him all this, but he insists upon keeping
his incognito—and I understand now that it is not Damocles but his
illness which interests him.
—You spoke of introducing me?...
—Yes, at once, if you like.
They went off immediately.

II
Not knowing him ourselves, we have decided not to say very much
about the waiter’s friend, Zeus, but just to report these few remarks.

INTERVIEW OF THE MIGLIONAIRE

The waiter:—Is it not true that you are very rich?


The Miglionaire, half turning towards Prometheus:—I am richer than
you can ever imagine. You belong to me; he belongs to me;
everything belongs to me.—You think I am a banker; I am really
something quite different. My effect on Paris is hidden, but it is none
the less important. It is hidden because it is not continuous. Yes, I
have above all the spirit of initiative. I launch; then, once the affair is
set going, I leave it; I have nothing more to do with it.
The waiter:—Isn’t it true that your actions are gratuitous?
The Miglionaire:—It is only I, only a person whose fortune is infinite,
who can act with absolute disinterestedness; for man it is
impossible. From that comes my love of gambling; I do not gamble
for gain, you understand—I gamble for the pleasure of gambling.
What could I gain that I do not possess already? Even time.... Do
you know my age?
Prometheus and the waiter:—You appear still young, sir.
The Miglionaire:—Well, do not interrupt me, Prometheus.—Yes, I
have a passion for gambling. My game is to lend to men. I lend, but
it is not for pleasure. I lend, but it is sinking the capital. I lend, but
with an air of giving.—I do not wish it known that I lend. I play, but I
hide my game. I experiment; I play, as a Dutchman sows his seed;
as he plants a secret bulb; that which I lend to men, that which I
plant in man, I amuse myself by watching it grow; without that, man
would be so empty!—Let me tell you my most recent experience.
You will help me to analyse it. Just listen, you will understand later.
I went down into the street with the idea of making some one suffer
for a gift I would make to another; to make one happy by the
suffering of the other. A blow and a note of £20 was all that was
necessary. To one the blow, and to the other the note. Is it clear?
What is less clear is the way of giving them.
—I know it already, interrupted Prometheus.
—Oh, really, you know of it, said Zeus.
—I have met both Damocles and Cocles; it is precisely about them
that I have come to speak to you:—Damocles looks and calls for
you, he is very anxious; he is ill;—for goodness’ sake go and see
him.
—Sir, stop—said Zeus—I have no need of advice from anybody.
—What did I tell you? said the waiter.
Prometheus was going away, but suddenly turned again: Sir, pardon
me. Excuse an indiscreet question. Oh! show it to me, I beg you! I
should love so much to see it....
—What?
—Your eagle.
—But I have no eagle, sir.
—No eagle? He has no eagle! But....
—Not so much of one as I can hold in the hollow of my hand. Eagles
(and he laughed), eagles! It is I who give them.
Prometheus was stupefied.
—Do you know what people say? the waiter asked the banker.
—What do they say?
—That you are God.
—I let them say so, said he.

III
Prometheus went to see Damocles; and then he went very often. He
did not talk to him every time; but in any case the waiter gave him
the news. One day he brought Cocles with him.
The waiter received them.
—Well, how is he? asked Prometheus.
—Bad. Very bad, replied the waiter. For three days the miserable
man has not been able to take any food. His bank-note torments
him; he looks for it everywhere; he thinks he may have eaten it;—he
takes a purgative and thinks to find it in his stool. When his reason
returns and he remembers his adventure, he is again in despair. He
has a grudge against you, Cocles, because he thinks you have so
complicated his debt that he no longer knows where he is. Most of
the time he is delirious. At night there are three of us to watch him,
but he keeps leaping upon his bed, which prevents us sleeping.
—Can we see him? said Cocles.
—Yes, but you will find him changed. He is devoured by anxiety. He
has become thin, thin, thin. Will you recognize him?—And will he
recognize you?
They entered on the tips of their toes.

THE LAST DAYS OF DAMOCLES

Damocles’ bedroom smelt horribly of medicines. Low and very


narrow, it was lighted gloomily by two night-lights. In an alcove,
covered with innumerable blankets, one could see Damocles tossing
about. He spoke all the time, although there was no one near him.
His voice was hoarse and thick. Full of horror Prometheus and Cocles
looked at each other; he did not hear them approach and continued
his moaning as if he were alone.
—And from that day, he was saying, it seemed to me, both that my
life began to have another meaning and that I could no longer live!
That hated bank-note I believed I owed it to every one and I dared
not give it to any one—without depriving all the others. I only
dreamed of getting rid of it—but how?—The Savings Bank! but this
increased my trouble; my debt was augmented by the interest on
the money; and, on the other hand, the idea of letting it stagnate
was intolerable to me; so I thought it best to circulate the sum; I
carried it always upon me; regularly every week I changed the note
into silver, and then the silver into another note. Nothing is lost or
gained in this exchange. It is circular insanity.—And to this was
added another torture: that it was through a blow given to another
that I received this note!
One day, you know well, I met you in a restaurant....
—He is speaking of you, said the waiter.
—The eagle of Prometheus broke the window of the restaurant and
put out Cocles’ eye.... Saved!!—Gratuitously, fortuitously,
providentially! I will slip my bank-note into the interstices of these
events. No more debt! Saved! Ah! gentlemen! what an error.... It
was from that day that I became a dying man. How can I explain
this to you? Will you ever understand my anguish? I am still in debt
for this note, and now it is no longer in my possession! I tried like a
coward to get rid of my debt, but I have not acquitted it. In my
nightmares I awake covered with perspiration. Kneeling down, I cry
aloud: Lord! Lord! to whom do I owe this? I know nothing of it, but I
owe—owing is like duty. Duty, gentlemen, is a horrible thing; look at
me, I am dying of it.
And now I am more tormented than ever because I have passed this
debt on to you, Cocles.... Cocles! it does not belong to you that eye,
as the money it was bought with did not belong to me. And what
hast thou that thou didst not receive? says the Bible ... received
from whom? whom?? Whom??... My distress is intolerable.
The wretched man spoke in short, sharp jerks; his voice grew
inarticulate, choked as it was by gasps, sobs and tears. Anxiously
Prometheus and Cocles listened; they took each other’s hand and
trembled. Damocles said, seeming to see them:
Debt is a terrible duty, gentlemen ... but how much more terrible is
the remorse of having wished to evade a duty.... As if the debt could
cease to exist because it was transferred to another.... But your eye
burns you, Cocles!—Cocles!! I am certain it burns you, your glass
eye; tear it out!—If it does not burn you, it ought to burn you, for it
is not yours—your eye ... and if it is not yours it must be your
brother’s ... whose is it? whose? Whose??
The miserable man wept; he became delirious and lost strength;
now and again fixing his eyes on Prometheus and Cocles he seemed
to recognize them, crying:
—But understand me for pity’s sake! The pity I claim from you is not
simply a compress on my forehead, a bowl of fresh water, a soothing
drink; it is to understand me. Help me to understand myself, for
pity’s sake! This which has come to me from I know not where, to
whom do I owe it? to whom?? to Whom??—And, in order to cease
one day from owing it one day, believing, I made with this a present
to others! To others!!—to Cocles—the gift of an eye!! but it is not
yours, that eye, Cocles! Cocles!! give it back. Give it back, but to
whom? to whom? to Whom??
Not wishing to hear more, Cocles and Prometheus went away.
IV
—There, you see, said Cocles, coming down the stairs, the fate of a
man who has grown rich by another’s suffering.
—But is it true that you suffer? asked Prometheus.
—From my eye occasionally, said Cocles, but from the blow, no
more; I prefer to have received it. It does not burn any more; it has
revealed to me my goodness. I am flattered by it; I am pleased
about it. I never cease to think that my pain was useful to my
neighbour and that it brought him £20.
—But the neighbour is dying of it, Cocles, said Prometheus.
—Did you not tell him that one must nourish one’s eagle? What do
you expect? Damocles and I never could understand each other, our
points of view are entirely opposed.
Prometheus said good-bye to Cocles and ran to the house of Zeus,
the banker.
—For goodness’ sake, show yourself! he said, or at least make
yourself known. The miserable man is dying. I could understand
your killing him since that is your pleasure; but let him know at least
who it is that is killing him—that he may be at peace.
The Miglionaire replied:—I do not wish to lose my prestige.

V
The end of Damocles was admirable; he pronounced a little while
before his last hour some words which drew tears from the most
unbelieving and made pious people say: How edifying! The most
notable sentiment was the one expressed so well in these words: I
hope at any rate that he will not have felt the loss of it.
—Who? asked some one.
—He, said Damocles, dying; he who gave me ... something.
—No! it was Providence, cleverly replied the waiter.
Damocles died after hearing these comforting words.

THE FUNERAL

—Oh! said Prometheus to Cocles, leaving the chamber of death,—all


that is horrible! The death of Damocles upsets me. Is it true that my
lecture can have been the cause of his illness?
—I cannot say, said the waiter, but I know that at any rate he was
greatly moved by all that you said of your eagle.
—Of our eagle, replied Cocles.
—I was so convinced, said Prometheus.
—That is why you convinced him.... Your words were very strong.
—I thought that no one paid any attention and I insisted.... If I had
known that he would listen so attentively....
—What would you have said?
—The same thing, stammered Prometheus.
—Then?
—But I would not say the same thing now.
—Are you no longer convinced?
—Damocles was too much so.... I have other ideas about my eagle.
—By the way, where is he?
—Do not fear, Cocles. I have my eye on him.
—Good-bye. I shall wear mourning, said Cocles. When shall we see
each other again?
—But ... at the funeral, I suppose. I will make a speech there. I
ought to repair in some way the damage I have done. And
afterwards I invite you to the funeral feast in the restaurant exactly
where we saw Damocles for the first time.

VI
At the funeral there were not many people; Damocles was very little
known; his death passed unnoticed except for those few interested
in his history. Prometheus, the waiter, and Cocles found themselves
at the cemetery, also a few idle listeners of the lecture. Every one
looked at Prometheus, as they knew he was to speak; and they said:
“What will he say?” for they remembered what he had said before.
Before Prometheus began to speak great astonishment was caused
by the fact that he was unrecognizable; he was fat, fresh, smiling;
smiling so much that his conduct was judged a little indecent, as
smiling still he advanced to the edge of the grave, turned his back
on it, and spoke these simple words:

THE HISTORY OF TITYRUS

—Gentlemen who are kind enough to listen to me, the words of


Scripture which serve as text for my brief discourse to-day are
these:
Let the dead bury their dead. We will therefore occupy ourselves no
more with Damocles.—The last time that I saw you all together was
to hear me speak of my eagle; Damocles died of it; leave the dead
... it is nevertheless because of him, or rather thanks to his death,
that now I have killed my eagle....
—Killed his eagle!!! cried every one.
—That reminds me of an anecdote.... Let us grant I have said
nothing.

I
In the beginning was Tityrus.
And Tityrus being alone and completely surrounded by swamps was
bored.—Then Menalcas passed by, who put an idea into the head of
Tityrus, a seed in the swamp before him. And this idea was the seed
and this seed was the Idea. And with the help of God the seed
germinated and became a little plant, and Tityrus in the evening and
in the morning knelt before it, thanking God for having given it to
him. And the plant became tall and great, and as it had powerful
roots it very soon completely dried up the soil around it, and thus
Tityrus had at last firm earth on which to set his feet, rest his head,
and strengthen the works of his hands.
When this plant had grown to the height of Tityrus, Tityrus tasted
the joy of sleeping stretched under its shadow. Now, this tree, being
an oak-tree, grew enormously; so much so that soon Tityrus’ hands
were no longer sufficient to till and hoe the earth around the oak—to
water the oak, to prune, to trim, to decorticate, to destroy the
caterpillars, and to ensure in due season the picking of its many and
diverse fruits. He engaged, therefore, a tiller and a hoer, and a
trimmer and a decorticator, and a man to destroy the caterpillars,
and a man to water the oak, and two or three fruit boys. And as
each had to keep strictly to his own speciality, there was a chance of
each person’s work being well done.
In order to arrange for the paying of the wages, Tityrus had to have
an accountant, who soon shared with a cashier the worries of
Tityrus’ fortune; this grew like the oak.
Certain arguments arising between the trimmer, and the pruner, and
the depilator—as to where each man’s work began and finished,
Tityrus saw the necessity of an arbitrator, who called for two lawyers
to expose both sides of the question.
Tityrus took a secretary to record their judgments, and as they were
only recorded for future reference, there had to be a keeper of the
rolls.
On the soil meanwhile houses appeared one by one, and it was
necessary to have police for the streets, to guard against excesses.
Tityrus, overcome by work, began to feel ill. He sent for a doctor
who told him to take a wife—and finding the work too much for him,
Tityrus was forced to choose a sheriff, and he himself was therefore
appointed mayor. From this time he had only very few hours of
leisure, when he could fish with a line from the windows of his
house, which still continued to open on the swamp.
Then Tityrus instituted bank holidays so that his people might enjoy
themselves; but as this was expensive and no one was very rich,
Tityrus, in order to be able to lend them all money, first began by
raising it from each of them separately.
Now the oak in the middle of the plain (for in spite of the town, in
spite of the effort of so many men, it had never ceased to be the
plain), the oak, as I said, in the middle of the plain, had no difficulty
in being placed so that one of its sides was in shadow and the other
in the sunshine. Under the oak then, on the shady side Tityrus
rendered justice; on the sunny side he fulfilled his natural
necessities. And Tityrus was happy, for he felt his life was useful to
others and fully occupied.

II

Man’s effort can be intensified. Tityrus’ activity seemed to grow with


encouragement; his natural ingenuity caused him to think of other
means of employment. He set to work to furnish and decorate his
house. The suitable character of the hangings and the convenience
of each object were much admired. Industrious, he excelled in
empiricism; he even made a little hook to hang his sponges on the
wall, which after four days he found perfectly useless. Then Tityrus
built another room by the side of his room, where he could arrange
the affairs of the nation; the two rooms had the same entrance, to
indicate that their interests were the same; but because of the one
entrance which supplied both rooms with air, the two chimneys
would not draw at the same time, so that when it was cold and a fire
was lighted in one, the other was full of smoke. The days therefore
that he wished for a fire, Tityrus was forced to open his window.
As Tityrus protected everything and worked for the propagation of
the species, a time came when the slugs crawled on his garden
paths in such abundance that he did not know where to step for fear
of crushing them and finally resigned.
He invited a woman with a circulating library to come to the town,
with whom he opened a subscription. And as she was called Angèle
he became accustomed to go there every three days and pass his
evenings with her. And by this means Tityrus learnt metaphysics,
algebra, and theodicy. Tityrus and Angèle began to practise together
successfully various accomplishments, and Angèle showing particular
taste for music, they hired a grand piano upon which Angèle played
the little tunes which between times he composed for her.
Tityrus said to Angèle: So many occupations will kill me. I am at the
end of my tether; I feel that I am getting used up, these
consolidated interests intensify my scruples, and as my scruples
grow greater I grow less. What is to be done?
—Shall we go away? said Angèle to him.
—I cannot go: I have my oak.
—Suppose you were to leave it, said Angèle.
—Leave my oak! You don’t mean it!
—Is it not large enough now to grow alone?
—But I am attached to it.
—Become unattached, replied Angèle.
And a little while after, having realized strongly that after all,
occupations, responsibilities, and other scruples could hold him no
more than the oak, Tityrus smiled and went off, taking with him the
cash-box and Angèle, and towards the end of the day walked with
her down the boulevard which leads from the Madeleine to the
Opéra.

III

That evening the boulevard had a strange look. One felt that
something unusually grave was going to happen. An enormous
crowd, serious and anxious, overflowed the pavement, spreading on
to the road, which the Paris police, placed at intervals, with great
trouble kept free. Before the restaurants, the terraces
disproportionately enlarged by the placing of chairs and tables,
made the obstruction more complete and rendered circulation
impossible. Now and again an onlooker impatiently stood upon his
chair for an instant—the time that one could beg him to get down.
Evidently all were waiting; one felt without doubt that between the
two pavements upon the protected route something was going to
pass. Having found a table with great difficulty and paid a large price
for it, Angèle and Tityrus installed themselves in front of two glasses
of beer and asked the waiter:
—What are they all waiting for?
—Where does your lordship come from? said the waiter. Does not
your lordship know that every one is waiting to see Melibœus? He
will pass by between 5 and 6 ... and there—listen: I believe one can
already hear his flute.
From the depths of the boulevard the frail notes of a pipe were
heard. The crowd thrilled with still greater attention. The sound
increased, came nearer, grew louder and louder.
—Oh, how it moves me! said Angèle.
The setting sun soon threw its rays from one end of the boulevard to
the other. And, as if issuing from the splendour of the setting sun,
Melibœus was at last seen advancing—preceded by the simple
sound of his flute.
At first nothing could be clearly distinguished but his figure, but
when he drew nearer:
—Oh, how charming he is! said Angèle. In the meantime Melibœus
as he arrived opposite Tityrus, ceased to play his flute, stopped
suddenly, saw Angèle, and every one realized that he was naked.
Oh! said Angèle, leaning upon Tityrus, how beautiful he is! what
strong thighs he has! His playing is adorable!
Tityrus felt a little uncomfortable.
—Ask him where he is going, said Angèle.
—Where are you going? questioned Tityrus.
Melibœus replied:—Eo Romam.
—What does he say? asked Angèle.
Tityrus:—You would not understand, my dear.
—But you can explain it to me, said Angèle.
—Romam, insisted Melibœus.... Urbem quam dicunt Romam.
Angèle:—Oh, it sounds delicious! What does it mean?
Tityrus:—But my dear Angèle, I assure you it is not so delightful as it
sounds; it means quite simply that he is going to Rome.
—Rome! said Angèle dreamily. Oh, I should love so much to see
Rome!
Melibœus, resuming his flute, once more began to play his primæval
melody, and at the sound, Angèle, in a passion of excitement, raised
herself, stood up, drew near; and as Melibœus’ arm was bent to her
hand, she took it, and thus the two together went on their way
along the boulevard; further, further they went, gradually vanished
from sight, and disappeared into the finality of the twilit dusk.
The crowd, now unbridled in its agitation, became more and more
tumultuous. On all sides one heard the questions: What did he say?
—What did he do?—Who was that woman?—And when, a few
minutes later, the evening papers appeared, a furious curiosity swept
over them like a cyclone, and it was suddenly divulged that the
woman was Angèle, and that this Melibœus was a naked person who
was going to Italy.
Then, all their curiosity having died down, the crowd streamed off
like water flowing away and the main boulevards were deserted.
And Tityrus found himself alone, completely surrounded by the
swamp.
Let us grant that I have said nothing.

An irrepressible laughter shook the audience for several seconds.


—Gentlemen, I am happy that my story has amused you, said
Prometheus, laughing also. Since the death of Damocles I have
found the secret of laughter. For the present I have finished,
gentlemen. Let the dead bury the dead and let us go quickly to
lunch.
He took the waiter by one arm and Cocles by the other; they all left
the cemetery; after passing the gates, the rest of the assembly
dispersed.
—Pardon me, said Cocles. Your story was charming, and you made
us laugh.... But I do not quite understand the connexion....
—If there had been more you would not have laughed so much, said
Prometheus. Do not look for too much meaning in all this. I wanted
above all to distract you, and I am happy to have done so; surely I
owed you that? I wearied you so the other day.
They found themselves on the boulevards.
—Where are we going? said the waiter.
—To your restaurant, if you do not mind, in memory of our first
meeting.
—You are passing it, said the waiter.
—I do not recognize it.
—It is all new now.
—Oh, I forgot!... I forgot that my eagle.... Don’t trouble: he will
never do it again.
—Is it true, said Cocles, what you say?
—What?
—That you have killed him?
—And that we are going to eat him?... Do you doubt it? said
Prometheus. Have you looked at me?—When he was alive, did I
dare to laugh?—Was I not horribly thin?
—Certainly.
—He fed on me long enough. I think now that it is my turn.
—A table! Sit down! Sit down, gentlemen!
—Waiter, do not serve us: as a last remembrance, take the place of
Damocles.

The meal was more joyful than it is possible to say. The eagle was
found to be delicious, and at dessert they all drank his health.
—Has he then been useless? asked one.
—Do not say that, Cocles!—his flesh has nourished us.—When I
questioned him he answered nothing, but I eat him without bearing
him a grudge: if he had made me suffer less, he would have been
less fat; less fat, he would have been less delectable.
—Of his past beauty, what is there left.
—I have kept all his feathers.
It is with one of them that I write this little book. May you, rare
friend, not find it too foolish.
Welcome to Our Bookstore - The Ultimate Destination for Book Lovers
Are you passionate about books and eager to explore new worlds of
knowledge? At our website, we offer a vast collection of books that
cater to every interest and age group. From classic literature to
specialized publications, self-help books, and children’s stories, we
have it all! Each book is a gateway to new adventures, helping you
expand your knowledge and nourish your soul
Experience Convenient and Enjoyable Book Shopping Our website is more
than just an online bookstore—it’s a bridge connecting readers to the
timeless values of culture and wisdom. With a sleek and user-friendly
interface and a smart search system, you can find your favorite books
quickly and easily. Enjoy special promotions, fast home delivery, and
a seamless shopping experience that saves you time and enhances your
love for reading.
Let us accompany you on the journey of exploring knowledge and
personal growth!

ebookball.com

You might also like