Example #1
0
        /// <summary>
        /// Constructor for the Game class
        /// </summary>
        public Game()
        {
            // Initialize the lifes at 3
            lifes = START_LIFES;

            // Initialize the level at 1
            level = 1;

            // Initialize the collection
            objectsCollection = new List <GameObject>();

            // Initialize the list of bullets to delete
            bulletsToDelete = new List <Bullet>(20);

            // Initialize the list of bullets
            bullets = new List <Bullet>(20);

            // Instantiate new enemies
            enemies = new Enemies(level);

            // Instantiate new Barriers
            barriers = new Barriers();

            // Instantiate new explosions
            explosions = new Explosions();

            // Instantiate a new Ovni
            ovni = new Ovni();

            // Game over is false when the game starts
            gameOver = false;
        }
Example #2
0
        /// <summary>
        /// Initialize the next level
        /// </summary>
        private void InitNextLevel()
        {
            // Reset the ship values
            ship.Init(level);

            // Instantiate new enemies
            enemies = new Enemies(level);

            // Instantiate new barriers
            barriers = new Barriers();

            // Instantiate a new ovni
            ovni = new Ovni();

            // Instantiate new explosions
            explosions = new Explosions();

            // Start the barriers
            barriers.Start();

            // Clears the objects collection
            objectsCollection.Clear();

            // Add the ship to the collection
            objectsCollection.Add(ship);

            // Add the enemies to the collection
            objectsCollection.Add(enemies);

            // Add the barriers to the collection
            objectsCollection.Add(barriers);

            // Add the explosions to the collection
            objectsCollection.Add(explosions);

            // Add the ovni to the collection
            objectsCollection.Add(ovni);

            // Call the get ready method
            GetReady();
        }