Coding the player's components and transform

Since Bob is the most significant object that uses an Animator, let's code all the necessary classes to get the player game object working. There are three components, AnimatedGraphicsComponent, PlayerInputComponent and PlayerUpdateComponent.

Before we code the components, we will also need a more advanced version of the Transform class.

PlayerTransform

Create a new class called PlayerTransform and add the member variables along with the constructor method. Notice the class extends Transform so it will also have access to the methods and members of the simpler Transform class we coded in Chapter 23: Coding the basic Transform.

import android.graphics.PointF; import android.graphics.RectF; import java.util.ArrayList; ...

Get Learning Java by Building Android Games - Second Edition 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.