Coding a slightly commented-out game object
The game is coming together nicely, and we can now turn our attention to the GameObject
class. Much will look familiar to the previous project. Create a class called GameObject
and add the following member variables.
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PointF;
import com.gamecodeschool.platformer.GOSpec.GameObjectSpec;
class GameObject {
private Transform mTransform;
private boolean mActive = true;
private String mTag;
private GraphicsComponent mGraphicsComponent;
private UpdateComponent mUpdateComponent;
}
Tip
Check the highlighted import
statement is correct for your project.
The members are almost the same as the previous ...
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.