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); Â Â Â ...