Detecting collisions
We don't need to detect everything bumping into everything else. Specifically, we need to detect the following three cases:
- An alien bumping into the player, resulting in losing a life
- The alien laser bumping into the player, resulting in losing a life
- The player's laser bumping into an alien, resulting in the score going up, a particle effect explosion being started, and the dead alien being respawned
In the update
method of the PhysicsEngine
class, change the return
statement as highlighted next:
// This signature and much more will change later in the project boolean update(long fps, ArrayList<GameObject> objects, GameState gs, SoundEngine se, ParticleSystem ps){ // Update all the...