Chapter 6. Physics

In the last chapter, we introduced one of the ways to move a character in AndEngine using the entity modifiers. However, for our game, we are going to use a physics engine. In this chapter, we will first introduce the physics engine used in AndEngine. We are also going to explain basic physics terms, such as force and velocity, and how they are used in AndEngine. We will cover the limitations of the physics engine too.

In the second part of this chapter, we will implement some of the actions of our character using the physics engine and accelerometer readings. We will also add platforms and the enemy to the game and define them as physics bodies.

The physics engine

AndEngine uses the Android port of the Box2D physics engine. Box2D ...

Get Learning AndEngine now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.