Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
AndEngine for Android Game Development Cookbook

You're reading from   AndEngine for Android Game Development Cookbook AndEngine is a simple but powerful 2D game engine that's ideal for developers who want to create mobile games. This cookbook will get you up to speed with the latest features and techniques quickly and practically.

Arrow left icon
Product type Paperback
Published in Jan 2013
Publisher Packt
ISBN-13 9781849518987
Length 380 pages
Edition 1st Edition
Arrow right icon
Authors (3):
Arrow left icon
Brian Boyles Brian Boyles
Author Profile Icon Brian Boyles
Brian Boyles
Nicolas Gramlich Nicolas Gramlich
Author Profile Icon Nicolas Gramlich
Nicolas Gramlich
JAYME SCHROEDER JAYME SCHROEDER
Author Profile Icon JAYME SCHROEDER
JAYME SCHROEDER
Arrow right icon
View More author details
Toc

Table of Contents (18) Chapters Close

AndEngine for Android Game Development Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
1. AndEngine Game Structure FREE CHAPTER 2. Working with Entities 3. Designing Your Menu 4. Working with Cameras 5. Scene and Layer Management 6. Applications of Physics 7. Working with Update Handlers 8. Maximizing Performance 9. AndEngine Extensions Overview 10. Getting More From AndEngine Source Code for MagneTank Index

Preface

AndEngine is an excellent, full-featured, free, and open source 2D framework for the Android platform. It is one of few 2D frameworks for the Android platform which is consistently being used to create stylish and fun games by both independent and professional developers alike, and has even been used in some of the most successful games on the market to date. However, it takes more than just using a specific framework to achieve success.

AndEngine for Android Game Development Cookbook provides many informative walkthroughs relating to the most important aspects of AndEngine at a general game-programming level. The book covers everything from the life cycle of an AndEngine game to placing sprites on the scene and moving them around, all the way through to creating destructible objects and raycasting techniques. Even more importantly, this book is entirely based on AndEngine's latest and most efficient Anchor-Center branch.

What this book covers

Chapter 1, AndEngine Game Structure, covers the important aspects of game development with AndEngine regarding the core components that most games need to survive. Everything from audio, textures, the AndEngine life cycle, saving/loading game data, and more, are covered in this chapter.

Chapter 2, Working with Entities, begins to familiarize us with AndEngine's Entity class as well as its subtypes, such as sprites, text, primitives, and more. The Entity class is the core component of AndEngine that allows objects in code to be displayed onscreen. More specifically, this chapter includes a list of the most important methods included in the Entity class in order to allow us to take full control over how our entities act, react, or simply what they will look like.

Chapter 3, Designing Your Menu, introduces some of the more common aspects of menu design in mobile games. The topics covered in this chapter include creating buttons, adding theme music to the menu, creating parallax backgrounds, and menu screen navigation. The topics found within this chapter can easily be used in other areas of a game as well.

Chapter 4, Working with Cameras, discusses the various options included in AndEngine when it comes to how the game camera and engine view the game's scene. We begin by going over the different types of camera objects available to us in order to give us a proper understanding of the benefits of each for an informative decision. From there, we continue on to cover camera movement and zooming, creating extra large backgrounds, creating a heads-up-display, and even go as far as introducing the split screen game engine for more complex game design.

Chapter 5, Scene and Layer Management, shows how to create a robust scene manager framework that incorporates scene-specific loading screens and animated layers. The managed scenes in this chapter utilize a resource manager and are extremely customizable.

Chapter 6, Applications of Physics, explores the various techniques used to create an AndEngine physics simulation with the Box2D physics extension. The recipes in this chapter cover the basic setup for a Box2D physics world: body types, category filtering, bodies with multiple fixtures, polygon-based bodies, forces, joints, rag dolls, rope, collision events, destructible objects, and raycasting.

Chapter 7, Working with Update Handlers, demonstrates the use of update handlers that are called once per engine update. The recipes in this chapter show how to register entity-based update handlers, conditional updating, and the creation of a game timer.

Chapter 8, Maximizing Performance, introduces some of the most beneficial, high-level practices to follow when it comes to improving the performance of any Android game. This chapter covers optimization techniques involving audio, graphical/rendering, and general memory management to help alleviate performance issues where necessary.

Chapter 9, AndEngine Extensions Overview, is where we discuss some of the more popular AndEngine extensions which can be beneficial to a project, depending on the game. These extensions may not be for everyone, but for those interested, this chapter includes insight on how we can go about creating live wallpapers, multiplayer components via networking servers and clients, creating high resolution SVG textures, and color mapping textures.

Chapter 10, Getting More From AndEngine, provides several useful recipes that expand upon the concepts presented in the previous chapters. The recipes in this chapter include batch texture-loading, textured meshes, autonomous shadows, moving platforms, and rope bridges.

Appendix A, Source Code for MagneTank, outlines the game, MagneTank, with class-by-class descriptions to show how a full game made with AndEngine can be set up. The game includes many of the recipes found throughout the chapters, and the source code is available with the bundled code.

Appendix B, Additional Recipes, is not present in the book but is available as a free download from the following link: http://downloads.packtpub.com/sites/default/files/downloads/8987OS_AppB_Final.pdf.

What you need for this book

AndEngine for Android Game Development Cookbook is useful for the majority of AndEngine developers. Starting with the first few chapters, the reader will begin to work with the basics of AndEngine, and even intermediate developers will find useful tips throughout these chapters. As the reader progresses through the chapters, topics that are more difficult will be covered so it is important that beginners do not skip ahead. Additionally, intermediate developers who have not yet made the transition to AndEngine's latest development branch will find useful information throughout the book on the differences between the GLES1/GLES2 branches versus the Anchor-Center branch discussed in this book.

A fundamental understanding of the Java programming language is suggested.

The software required in order to execute the various topics in this book include the Eclipse IDE for building and compiling the code, GIMP for image drawing/editing, and Inkscape for SVG drawing/editing. Please feel free to use alternatives to these products if you are more comfortable with them. Additionally, this book assumes the reader has obtained the required libraries, including AndEngine and its various extensions prior to working with the recipes.

Who this book is for

AndEngine for Android Game Development Cookbook is geared toward developers who are interested in working with the most up-to-date version of AndEngine, sporting the brand new GLES 2.0 Anchor-Center branch. The book will be helpful for developers who are attempting to break into the mobile game market intending to release fun and exciting games while eliminating a large portion of the learning curve that is otherwise inevitable when getting into AndEngine development.

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: " To start with the absolute most basic Entity method, we will attach an Entity object to a Scene object."

A block of code is set as follows:

  float baseBufferData[] = {
      /* First Triangle */
      0, BASE_HEIGHT, UNUSED, /* first point */
      BASE_WIDTH, BASE_HEIGHT, UNUSED, /* second point */
      BASE_WIDTH, 0, UNUSED, 	/* third point */

      /* Second Triangle */
      BASE_WIDTH, 0, UNUSED, /* first point */
      0, 0, UNUSED, /* second point */
      0, BASE_HEIGHT, UNUSED, /* third point */
  };

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 , 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/support, 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 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 if you are having a problem with any aspect of the book, and we will do our best to address it.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime