/** Checks all collisions between collidables */ public void checkCollisions() { ArrayList<Bullet> bulletList = boat .getBulletsList(); // fire methodu çağıtıldığında boatun içinde oluşan bulletların // listesi Rectangle boatBound = boat.getBounds(); // boat ve ada çarpışması for (int i = 0; i < islands.size(); i++) { Island is = (Island) islands.get(i); Rectangle islandBound = is.getBounds(); if (boatBound.intersects(islandBound)) { boat.setVisible(false); } } // boat ve buoy çarpışması for (int i = 0; i < buoys.size(); i++) { Buoy b = (Buoy) buoys.get(i); Rectangle buoyBound = b.getBounds(); if (boatBound.intersects(buoyBound)) { b.setVisible(false); // timer.stop(); } } // boat ve uncracked/cracked bonus çarpışması for (int i = 0; i < bonuses.size(); i++) { Bonus b = (Bonus) bonuses.get(i); Rectangle bonusBound = b.getBounds(); if (boatBound.intersects(bonusBound)) { if (!b.isCracked()) { // boat&uncracked bonus çarpışması boat.setVisible(false); } else { // boat&bonus çarpışması b.setVisible(false); } } } // bullet ve bonus(uncracked) çarpışması for (int i = 0; i < bulletList.size(); i++) { Bullet bu = (Bullet) bulletList.get(i); Rectangle bulletBound = bu.getBounds(); for (int k = 0; k < bonuses.size(); k++) { Bonus bo = (Bonus) bonuses.get(k); Rectangle bonusBound = bo.getBounds(); if (bonusBound.intersects(bulletBound) && !bo.isCracked()) { bo.setCracked(true); // bo.setBonusImage(bo.getBonusType());//burası çok önemli, bonus baştan yaratılıyor // sayılır. bo.setRandomBonusImage(); bu.setVisible(false); } } } }