PacktLib: AndEngine for Android Game Development Cookbook

AndEngine for Android Game Development Cookbook


About the Authors

About the Reviewers


AndEngine Game Structure


Know the life cycle

Choosing our engine type

Selecting a resolution policy

Creating object factories

Creating the game manager

Introducing sounds and music

Working with different types of textures

Applying texture options

Using AndEngine font resources

Creating the resource manager

Saving and loading game data

Working with Entities


Understanding AndEngine entities

Applying primitives to a layer

Bringing a scene to life with sprites

Applying text to a layer

Using relative rotation

Overriding the onManagedUpdate method

Using modifiers and entity modifiers

Working with particle systems

Designing Your Menu


Adding buttons to the menu

Adding music to the menu

Applying a background

Using parallax backgrounds to create perspective

Creating our level selection system

Hiding and retrieving layers

Working with Cameras


Introducing the camera object

Limiting the camera area with the bound camera

Taking a closer look with zoom cameras

Creating smooth moves with a smooth camera

Pinch-zoom camera functionality

Stitching a background together

Applying a HUD to the camera

Applying a controller to the display

Coordinate conversion

Creating a split screen game

Scene and Layer Management


Creating the scene manager

Setting up the resource manager for scene resources

Customizing managed scenes and layers

Setting up an activity to use the scene manager

Applications of Physics

Introduction to the Box2D physics extension

Understanding different body types

Creating category-filtered bodies

Creating multiple-fixture bodies

Creating unique bodies by specifying vertices

Using forces, velocities, and torque

Applying anti-gravity to a specific body

Working with joints

Creating a rag doll

Creating a rope

Working with collisions

Using preSolve and postSolve

Creating destructible objects


Working with Update Handlers

Getting started with update handlers

Attaching an update handler to an entity

Using update handlers with conditionals

Handling the removal of an entity from the game

Adding game timers

Setting entity properties based on the time passed

Maximizing Performance


Ignoring entity updates

Disabling background window rendering

Limiting simultaneous sound streams

Creating sprite pools

Cutting down render time with sprite groups

AndEngine Extensions Overview


Creating live wallpaper

Networking with the multiplayer extension

Creating high-resolution graphics with SVG

Color mapping with SVG texture regions

Getting More From AndEngine

Loading all textures from a folder

Using textured meshes

Applying a sprite-based shadow

Creating a physics-based moving platform

Creating a physics-based rope bridge

Source Code for MagneTank

Source Code for MagneTank

Source Code for MagneTank

Source Code for MagneTank

Source Code for MagneTank

Source Code for MagneTank