public override void Update(FrameEvent evt) { Animate(evt); remove = isCollidingWith("CannonBall"); remove1 = isCollidingWith("Player"); if (remove) { score.Increase(increase); } if (remove1) { score.Decrease(10); shield.Decrease(20); } // Collision detection with the player goes here // (ignore until week 8) ... }
public void Update(FrameEvent evt) { Animate(evt); remove = isCollidingWith("CannonBall"); if (!remove) { remove = isCollidingWith("Bomb"); } if (remove) { score.Increase(increase); } touchesPlayer = isCollidingWith("Player"); if (touchesPlayer) { if (shield.Value > 0) { shield.Decrease(35); } else { health.Decrease(30); } score.Decrease(35); } if (health.Value <= 0) { lives.Decrease(1); if (lives.Value > 0) { health.Reset(); } } // Collision detection with the player goes here // (ignore until week 8) ... }