public bool IsHittedBy(Asteroid asteroid) { if (this.XPos == asteroid.XPos && this.YPos == asteroid.YPos) { return true; } return false; }
// V6 Supercharged private static void Engine(List<Asteroid> asteroids, Ship ship) { char shieldOrientetion = 'L'; while (lives > 0) { shieldOrientetion = PressedKey(shieldOrientetion); if (levelCounter == difficulty) { // Control the asteroid creation Asteroid newAsteroid = new Asteroid(PickUpChar(), ConsoleColor.Cyan); if (newAsteroid.Symbol == '\u263A') { newAsteroid.Color = ConsoleColor.Yellow; } if (newAsteroid.Symbol == '\u2665') { newAsteroid.Color = ConsoleColor.Red; } asteroids.Add(newAsteroid); levelCounter = 0; } levelCounter++; Shield shield = new Shield(shieldOrientetion, 1, ship); // Move the asteroids for (int index = 0; index < asteroids.Count; index++) { asteroids[index].Clear(); asteroids[index].Move(); } Collisions(asteroids, ship, shield); ship.Draw(); shield.Draw(); DrawInterface(lives, score); // draw score and lives in separated cells // Slow down the game Thread.Sleep(gameSpeed); shield.Clear(); } }