Create a new package private class called PhysicsEngine
and add the following code.
class PhysicsEngine { // This signature and much more will //change later in the project boolean update(long fps, ParticleSystem ps){ if(ps.mIsRunning){ ps.update(fps); } return false; } // Collision detection method will go here }
The PhysicsEngine
class only has one method for now, update
. By the end of the project it will have another method for checking collisions. The signature of the update
method receives the frames per second and a ParticleSystem
. The code simply checks if the ParticleSystem
is running and if it is calls its update
method and passes in the required fps
.
Now we can create an instance of the PhysicsEngine
and call it supdate
method each frame. Create an instance of the PhysicsEngine
class with this highlighted line of code as a member of the GameEngine
class:
… private GameState mGameState...