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
Learning AndEngine

You're reading from   Learning AndEngine Design and create Android games with the simple but powerful tool AndEngine

Arrow left icon
Product type Paperback
Published in Sep 2014
Publisher
ISBN-13 9781783985968
Length 286 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Martin Varga Martin Varga
Author Profile Icon Martin Varga
Martin Varga
Arrow right icon
View More author details
Toc

Assembling bodies from fixtures


So far, we have only used the AndEngine class, PhysicsFactory, to create rectangle (box) bodies. It is the simplest and most straightforward way to create bodies. The whole creation of a body remains hidden.

A body consists of one or more fixtures. Let's create a slightly more complicated body by manually creating three fixtures and putting them together to form a body. We will first create fixtures for the head, torso, and body, just to illustrate how to create multiple fixtures, but we are going to see how filtering works on the example of these fixtures as well.

Tip

There are more ways of creating fixtures. One of the more automated ways is to use an external editor such as R.U.B.E. and a loader that will load the data to AndEngine. However, such a loader exists only as an unofficial extension.

Here's a screenshot showing how the final body should look in the game:

Creating an empty body

First, we need to create an empty body. The body is in fact just a virtual...

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