Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void detectProjectileCollisionWithAlien() {
- // Required.
- for (int x = 0; x < alienList.length; x ++ ) {
- Alien currentAlien = alienList[x];
- if (currentAlien != null) {
- Iterator<Projectile> itr = projectileList.iterator();
- while(itr.hasNext()) {
- Projectile p = itr.next();
- if (p.getCurrentX() + p.getWidth() >= currentAlien.getCurrentX()
- && p.getCurrentX() <= currentAlien.getCurrentX() + currentAlien.getWidth()
- &&
- p.getCurrentY() + p.getHeight() >= currentAlien.getCurrentY()
- && p.getCurrentY() <= currentAlien.getCurrentY() + currentAlien.getHeight()) {
- itr.remove();
- alienList[x] = null;
- updatePlayerScore();
- break;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment