Пример #1
0
        public void add(Game game)
        {
            //int Baseline = game.Window.ClientBounds.Height - 100;
            int Baseline = game.Window.ClientBounds.Height;
            int randX = RandomNumber(0, game.Window.ClientBounds.Width);

            Vector2 dest = new Vector2 (randX, Baseline);
            Enemy temp = new Enemy(new Vector2(RandomNumber(0, game.Window.ClientBounds.Width), 0), dest, MinionSpeed, minionExplosion, game);
            int number = RandomNumber(0, 100);
            if (number < 50)
                temp = new Enemy(new Vector2(RandomNumber(0, game.Window.ClientBounds.Width), 0), dest, MinionSpeed, minionExplosion, game);
            else if (number < 80)
                temp = new CurvingEnemy(new Vector2(RandomNumber(0, game.Window.ClientBounds.Width), 0), dest, MinionSpeed, minionExplosion, game);// Add curving enemy
            else
                temp = new SplitterEnemy(new Vector2(RandomNumber(0, game.Window.ClientBounds.Width), 0), dest, MinionSpeed, minionExplosion, game, this);//Add splitting enemy

            minions.AddLast(temp);
        }
Пример #2
0
 private bool Collision(Enemy test)
 {
     Rectangle temp = new Rectangle((int)test.position.X, (int)test.position.Y, test.image.Width, test.image.Height);
     if (imageBox.Intersects(temp)) return true;
     return false;
 }