Book Image

LibGDX Game Development By Example

By : James Cook
Book Image

LibGDX Game Development By Example

By: James Cook

Overview of this book

Table of Contents (18 chapters)
LibGDX Game Development By Example
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Preface

Video games have been around for over 30 years now and many of us have grown up with some form of experience playing video games. Most of us will want to go on and make our own games. It has never been easier to create your own game and deliver it to the world, whether you want to make a game to share with your friends or want to start a career in the game development industry.

Owing to the ease of development, a whole host of different tools are available to help you create games. Depending on whether you want to develop for desktop, iOS, Android, or HTML5, there are different tools available. However, what if you wanted to develop for all platforms? This is where an awesome framework called LibGDX comes in.

If you are reading this book, you are probably already aware of LibGDX. You may not be proficient in it, and you may not even have used it yet. But that's OK! That's why you are reading this book. We will use LibGDX to create a series of games, each game introducing another set of features of LibGDX. Hopefully, by the end of this book, you will have the foundation to go on and comfortably start making your own games.

What this book covers

Chapter 1, Getting to Know LibGDX, introduces us to LibGDX and helps us to set up our development environment to get ready to create our first ever LibGDX project.

Chapter 2, Let's Get These Snakes Out of This Book!, covers creating our first game using LibGDX—Snake! This also covers the game cycle and how to handle input through LibGDX.

Chapter 3, Making That Snake Slick, covers creating game states, continuing with our Snake game from the previous chapter. This also covers an introduction to the techniques used to help with development and talks about handling different screen sizes and resolutions.

Chapter 4, What the Flap Is the Hype About?, explains how to create our second game, Flappy Bee, our own interpretation of a famous mobile game. Here, we are introduced to handling animations and using LibGDX's Scene2D to create a GUI menu.

Chapter 5, Making Your Bird More Flightworthy, explores our Flappy Bee game a little further, where we look at handling assets in LibGDX as well as using one of the tools—Heiro—for converting fonts.

Chapter 6, Onto the Next Platform...Game, introduces you to our next game, where we create a simple platform game—Pete the Squirrel! Here, we cover the use of a tile mapping tool—Tiled—and discuss how LibGDX integrates with it.

Chapter 7, Extending the Platform, discusses handling the LibGDX camera to create scrolling levels and introduces playing sounds.

Chapter 8, Why Are All the Birds Angry?, covers our final game in this book. We look at creating our own version of Angry Birds, where we look at how LibGDX and Box2D work together to create an awesome game.

Chapter 9, Even Angrier Birds!, closes our final game by looking at object pooling in LibGDX and showing how it can be used to help with performance and memory management.

Chapter 10, Exporting Our Games to the Platforms, introduces you to how we can use LibGDX to export our awesome games to Android, iOS, and HTML5.

Chapter 11, Third-party Services, covers integrating a platform-specific service into a LibGDX game.

What you need for this book

It is entirely possible to enjoy and learn from this book without having to use a computer. However, I would recommend that you run the examples while you read this book.

The first chapter covers how to get your computer set up to run these examples. A computer with a minimum of a dual core processor and 4GB RAM is preferable.

Who this book is for

This book is about getting started with making games using LibGDX. So, complete beginners are more than welcome on our journey to create games. No previous experience of LibGDX is necessary, however, some basic Java knowledge will help.

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "The Gdx.log() methods is extremely handy when it comes to debugging our games"

A block of code is set as follows:

public void render(float delta) {
  batch.begin();
  sprite.draw(batch);
  batch.end();
}

Any command-line input or output is written as follows:

java -verlsion

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "Before we hit the Generate button, let's just take a look at what we are creating."

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 disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail , and mention the book's title in 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 at 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 from your account at http://www.packtpub.com for all the Packt Publishing books you have purchased. 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.

Downloading the color images of this book

We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from https://www.packtpub.com/sites/default/files/downloads/B04176_1440OS_ColorImages.pdf.

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 could 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 to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted 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 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

If you have a problem with any aspect of this book, you can contact us at , and we will do our best to address the problem.