Every object is a GameObject
This class will become a living-breathing (or flying-shooting or diving) combination of our various components.
Create the GameObject
class and add the import
statements and constructor shown here:
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; }
Here, we can see that we have an instance of the Transform
class called mTransform
. In addition, we have a boolean
member variable called isActive
. This will act as an indicator of whether the object is currently in use or not. The mTag
variable will be...