Esempio n. 1
0
        public void AddEnemy()
        {
            if (CharPool.Count == 0)
            {
                gameLevel.levelUp();
                TheForm.TimerCreateLetter.Interval = gameLevel.ENEMY_APPEAR;
                TheForm.TimerMoveEnemies.Interval  = gameLevel.ENEMY_SPEED;
                generatePool();
                if (gameLevel.LEVEL % 3 == 0)
                {
                    TheForm.BackgroundImage = GameBackground.NextImage();
                    TheForm.changeColorLabel();
                }
            }
            int  i        = Random.Next(0, CharPool.Count);
            Char selected = CharPool[i];

            CharPool.RemoveAt(i);
            Enemy enemy        = enemy = new Enemy(TheForm, findValidSpawn(), selected);
            bool  thereIsPower = false;

            foreach (Enemy e in Enemies)
            {
                if (e.Name == "SlowMotion" || e.Name == "Bonus" || e.Name == "Destroyer")
                {
                    thereIsPower = true;
                }
            }

            if (!thereIsPower && !isSlowMotionActive && gameLevel.LEVEL > 1)
            {
                int rnd = Random.Next(0, 30);
                if (rnd == 7 && gameLevel.LEVEL > 3)
                {
                    enemy = new PowerUp_SlowMotion(TheForm, findValidSpawn(), selected);
                }
                else if (rnd > 26)
                {
                    enemy = new PowerUp_Bonus(TheForm, findValidSpawn(), selected);
                }
                else if (rnd == 13 && gameLevel.LEVEL > 4)
                {
                    enemy = new PowerUp_Destroyer(TheForm, findValidSpawn(), selected);
                }
            }
            Enemies.Add(enemy);
        }
Esempio n. 2
0
        public void AddEnemy()
        {
            if (CharPool.Count == 0)
            {
                gameLevel.levelUp();
                TheForm.TimerCreateLetter.Interval = gameLevel.ENEMY_APPEAR;
                TheForm.TimerMoveEnemies.Interval  = gameLevel.ENEMY_SPEED;
                generatePool();
            }
            int  i        = random.Next(0, CharPool.Count);
            Char selected = CharPool[i];

            CharPool.RemoveAt(i);
            Enemy enemy = new Enemy(TheForm, findValidSpawn(), selected);

            Enemies.Add(enemy);
            TheForm.GetControls().Add(enemy);
        }