Example #1
0
 public HeatSeekingMissile(Vector2 _pos, CollisionManager.Side _side)
     : base(_pos, _side)
 {
     closestEnemyOnCreate = Shmup.GameObjects.Where(e => e is Enemy).OrderByDescending(e => Vector2.Distance(e.GetPosition(), this.GetPosition())).FirstOrDefault() as Enemy;
     textureFile = "Sprites/HeatSeekingMissile";
     speed = 5;
     damage = 20;
     SoundEffect shotSound = Shmup.contentManager.Load<SoundEffect>("Sounds/47252__nthompson__rocketexpl");
     shotSound.Play(0.5f, 0f, 0f);
 }
Example #2
0
        private void debugSpawnEnemy(GameTime gameTime)
        {
            // minimum, maximum time between spawning enemies
            if (Environment.TickCount - debugTimeElapsed > (random.Next(2000, 5000)))
            {
                Enemy badguy = new Enemy(new Vector2(-100, -100));
                badguy.Load(base.Content);

                float x = (float)Shmup.random.NextDouble() * Shmup.SCREEN_WIDTH;
                float y = -1.0f * 10; // badguy.texture.Height;
                badguy.SetPosition(new Vector2(x, y));

                Shmup.GameObjects.Add(badguy);
                debugTimeElapsed = Environment.TickCount;
            }
        }