Every object is a GameObject
This class will become a living-breathing (or flying-shooting or diving etc) combination of our various components.
Create the GameObject
class and add the import
statements and constructor shown next.
import android.content.Context; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.PointF; class GameObject { private Transform mTransform; private boolean isActive = false; private String mTag; private GraphicsComponent graphicsComponent; private MovementComponent movementComponent; private SpawnComponent spawnComponent; }
We can see in the previous code that we have an instance of the Transform
class called mTransform
. In addition, we have a boolean
called isActive
which will act as ...
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.