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; class PlayerTransform extends Transform { private ArrayList<RectF> mColliders; private final float TENTH = .1f; private final float HALF = .5f; private final float THIRD = .3f; private final float...