Putting everything together
We just need to tie up a few loose ends so that we can run the game.
Updating GameEngine
Add an instance of the Level
class to GameEngine
:
... HUD mHUD; Renderer mRenderer; ParticleSystem mParticleSystem; PhysicsEngine mPhysicsEngine; Level mLevel;
Initialize the instance of Level
in the GameEngine
constructor:
public GameEngine(Context context, Point size) { super(context); mUIController = new UIController(this, size); mGameState = new GameState(this, context); mSoundEngine = new SoundEngine(context); mHUD = new HUD(size); mRenderer = new Renderer(this); mPhysicsEngine = new PhysicsEngine(); mParticleSystem = new ParticleSystem(); mParticleSystem.init(1000); ...