Preface
LÖVE is a popular open source 2D video game framework that allows you to leverage the simplicity of the Lua scripting language in developing game prototypes quickly and easily. LÖVE's robustness and active community support make it a viable framework for game development. It has empowered a lot of indie developers of various ages around the world, giving them an edge in tapping into the lucrative video game market.
Its simplicity and "write less build more" nature make it easy for both experienced and novice developers.
This book is a comprehensive tutorial, demonstrating the full potential of LÖVE framework. It takes you through building a prototype to packaging games quickly with LÖVE.
What this book covers
Chapter 1, Getting Started with LÖVE, gets you up-and-running with LÖVE and shows you how to install LÖVE framework and run a LÖVE game.
Chapter 2, LÖving Up!, takes you through drawing a 2D object, moving objects, and animating a game character.
Chapter 3, Before You Build a Game, takes you through the necessary things you need to know before you develop your game.
Chapter 4, Making Your First Game, sets the magic rolling! The chapter will take you through designing and loading a game level, and setting up your game characters and assets.
Chapter 5, More About Making the Game, introduces you to game physics—adding collisions and gravity to game objects—and a more efficient way to animate characters.
Chapter 6, Meeting the Bad Guy!, explains how to set up the enemy character.
Chapter 7, Pickups and Head-Up Display and Sounds, explains how to set up the extras: pickups, sounds, and Head-Up Display (HUD).
Chapter 8, Packaging and Distributing Your Game, explains how to package and distribute our game to various platforms, now that your game is ready to ship.
What you need for this book
To run the examples in the book, the following software will be required:
Operating systems:
Windows XP or above (for Windows users)
Ubuntu 10.10 or above (for Linux users)
Mac OS X (for Mac users)
LÖVE framework 0.80 or above (www.love2d.org)
Tiled Map Editor (www.mapeditor.org)
Notepad++ Text Editor (www.notepad-plus-plus.org)
Who this book is for
This book is for aspiring game developers with a decent understanding of Lua scripting language, and anyone who wants to learn video game design. If you are looking for a step-by-step approach to learn how to design a game from idea to prototype quickly with a robust and easy-to-understand game engine, this book is for you.
Conventions
In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.
Code words in text are shown as follows:
"We can configure the screen size and program title using the love.conf(w)
"
A block of code is set as follows:
function love.conf(w) w.screen.width = 800 w.screen.height = 600 w.screen.title = "Goofy's Adventure" end
A comment within a block of code starts with a double hyphen "--"
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
findSolidTiles(map) for i, obj in pairs( map("Objects").objects ) do if obj.type == "player" then PlayerSpawn(obj.x,obj.y-8) end if obj.type == "enemy" then EnemySpawn(obj.x,obj.y-14,obj.properties.dir) end ---insert items here if obj.type == "diamond" then DiamondSpawn(obj.x,obj.y-16) end if obj.type == "coins" then CoinSpawn(obj.x,obj.y-16) end if obj.type == "life" then LifeSpawn(obj.x,obj.y-16) end end
Any command-line input or output is written as follows:
# cd c:/users/DarmieAkinlaja/My Documents/My game
New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: " for example on my computer, the My game folder is stored in My Documents folder ".
Note
Warnings or important notes appear in a box like this.
Tip
Tips and tricks appear like this.
Reader feedback
Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.
To send us general feedback, simply send an e-mail to <[email protected]>
, and mention the book title via the subject of your message.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.
Customer support
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
Downloading the example code
You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.
Errata
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.
Piracy
Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at <[email protected]>
with a link to the suspected pirated material.
We appreciate your help in protecting our authors, and our ability to bring you valuable content.
Questions
You can contact us at <[email protected]>
if you are having a problem with any aspect of the book, and we will do our best to address it.