Book Image

Learning AndEngine

By : Martin Varga
Book Image

Learning AndEngine

By: Martin Varga

Overview of this book

AndEngine is a very popular open source OpenGL (open graphics library) Android game engine, used to create mobile games quickly while maintaining the ability to fully customize them. This book will guide you through the whole development process of creating a mobile game for the Android platform using one of the most popular and easy-to-use game engines available today. Beginning with the very basics, you will learn how to install AndEngine, gather graphics, add sound and music assets, and design game rules. You will first design an example game and enhance it by adding various features over the course of the book. Each chapter adds more colors, enhances the game, and takes it to the next level. You will also learn how to work with Box2D, a popular 2D physics engine that forms an integral part of some of the most successful mobile games. By the end of the book, you will be able to create a complete, interactive, and fully featured mobile game for Android and publish it to Google Play.
Table of Contents (19 chapters)
Learning AndEngine
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

HUD


To understand how heads-up display works, simply imagine that we draw something on a piece of glass and put this glass in front of a camera in a way that whenever the camera moves, the glass moves with it. This is exactly what we need to display the score.

AndEngine has a concept of camera scene, a scene that works as the glass. HUD is a special camera scene that has no background, so it is always see-through.

Have a look at the following illustration of how the HUD works. The black rectangle defines the visible portion of the scene. The HUD is the translucent rectangle. The resulting image has the text in the top-left corner. Even if the visible portion of the scene changes because of camera movement, the text will stay in the corner.

Another important feature of the HUD is that it is always drawn last. Even if we set a z-index of an entity to a lower number in the HUD than all the other entities in the scene, the HUD entity will be drawn on top of them. An entity attached to the HUD can...