public static void FiresUpdate(ref List <Fire> bullets, List <Enemies> versus)// collision between plane fires and all enemies { for (int x = 0; x < bullets.Count; ++x) { Fire fire = bullets[x]; // plane's fires foreach (Enemies q in versus) // enemies { if (Events.pixelCollesion(q.texturesCollection[q.StandardImgFrame], fire.texturesCollection[fire.StandardImgFrame], new Vector2((float)q.cordx, (float)q.cordy), new Vector2((float)fire.cordx, (float)fire.cordy))) { fire.Exist = false; Events.score++; q.enemhealth -= 30; if (q.enemhealth <= 0) { q.Exist = false; Events.score += 2; } } } if (fire.OutOfBorders(fire.width, fire.height) || !fire.Exist) // delete fire { bullets.Remove(fire); fire.Exist = false; x--; } else // update { fire.Update(); } } }
public static void FiresUpdate(ref List <Fire> bullets, MainPlane versus)// collision between all anemies fires and Plane { for (int x = 0; x < bullets.Count; ++x) { Fire fire = bullets[x]; if (Events.pixelCollesion(versus.texturesCollection[versus.StandardImgFrame], fire.texturesCollection[fire.StandardImgFrame], new Vector2((float)versus.cordx, (float)versus.cordy), new Vector2((float)fire.cordx, (float)fire.cordy))) { fire.Exist = false; Events.health -= 20; } if (fire.OutOfBorders(fire.width, fire.height) || !fire.Exist) // delete { bullets.Remove(fire); fire.Exist = false; x--; } else // update { fire.Update(); } } }