private int handleCollisions() { List <Enemy> enemies = em.enemies; //Schiff wird zerstoert am linken Rand if (player.position.X < 0) { padScore(); player.killPlayer(); } if (!(enemies == null)) { //check for collision with each enemy and with each of its fired shots foreach (Enemy e in enemies) { //player projectiles right for (int i = 0; i < player.gr_projectiles_right.Count; i++) { if (e.Intersects(player.gr_projectiles_right[i])) { player.gr_projectiles_right.RemoveAt(i); // delete shot after collision - handled in player in differnt modes? e.killEnemy(); player.score += 1000; // should depend on type of enemy } } //player projectiles right for (int i = 0; i < player.gr_projectiles_left.Count; i++) { if (e.Intersects(player.gr_projectiles_left[i])) { player.gr_projectiles_left.RemoveAt(i); e.killEnemy(); player.score += 1000; } } //collision between enemy and player if (player.Intersects(e.enemyBounds)) { padScore(); player.killPlayer(); e.killEnemy(); return(1); } //enemy projectiles foreach (Rectangle r in e.gr_projectiles) { if (player.Intersects(r)) { padScore(); e.gr_projectiles.Remove(r); player.killPlayer(); return(1); } } } } if (pum.powerUps != null) { for (int i = 0; i < pum.powerUps.Count; i++) { //change properties of player according to type of power up if (player.Intersects(pum.powerUps[i].puRect)) { pum.powerUps[i].pickUp(); player.addPowerUp(pum.powerUps[i].type); } } } return(0); }