Code the GameEngine
Now we get to the class that glues all the others together. In the code that follows we will declare and use an instance of LevelManager
that we will code immediately after GameEngine
. All the rest of the code will at last be error free and nearly ready to execute.
Add the GameEngine
class, its members and constructor as shown next.
import android.content.Context; import android.graphics.Point; import android.util.Log; import android.view.MotionEvent; import android.view.SurfaceView; import java.util.concurrent.CopyOnWriteArrayList; class GameEngine extends SurfaceView implements Runnable, GameEngineBroadcaster, EngineController { private Thread mThread = null; private long mFPS; private GameState mGameState; UIController mUIController; ...
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.