Ejemplo n.º 1
0
 /// <summary>
 /// Creats the effect for when the player fires a bullet.
 /// </summary>
 /// <param name="position">Where on the screen to create the effect.</param>        
 public void CreatePlayerFireSmoke(Player player)
 {
     for (int i = 0; i < 8; ++i)
     {
         Particle p = CreateParticle();
         p.Texture = smoke;
         p.Color = Color.White;
         p.Position.X = player.Position.X + player.Width / 2;
         p.Position.Y = player.Position.Y;
         p.Alpha = 1.0f;
         p.AlphaRate = -1.0f;
         p.Life = 1.0f;
         p.Rotation = 0.0f;
         p.RotationRate = -2.0f + 4.0f * (float)random.NextDouble();
         p.Scale = 0.25f;
         p.ScaleRate = 0.25f;
         p.Velocity.X = -4 + 8.0f * (float)random.NextDouble();
         p.Velocity.Y = -16.0f + -32.0f * (float)random.NextDouble();
     }
 }
Ejemplo n.º 2
0
        public GameplayScreen()
        {
            random = new Random();

            worldBounds = new Rectangle(0, 0, 320, 480);

            player = new Player();
            playerBullets = new List<Bullet>();

            aliens = new List<Alien>();
            alienBullets = new List<Bullet>();

            gameOver = true;

            TransitionOnTime = TimeSpan.FromSeconds(0.0);
            TransitionOffTime = TimeSpan.FromSeconds(0.0);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Creats the mud/dust effect when the player moves.
 /// </summary>
 /// <param name="position">Where on the screen to create the effect.</param>        
 public void CreatePlayerDust(Player player)
 {
     for (int i = 0; i < 2; ++i)
     {
         Particle p = CreateParticle();
         p.Texture = smoke;
         p.Color = new Color(125, 108, 43);
         p.Position.X = player.Position.X + player.Width * (float)random.NextDouble();
         p.Position.Y = player.Position.Y + player.Height - 3.0f * (float)random.NextDouble();
         p.Alpha = 1.0f;
         p.AlphaRate = -2.0f;
         p.Life = 0.5f;
         p.Rotation = 0.0f;
         p.RotationRate = -2.0f + 4.0f * (float)random.NextDouble();
         p.Scale = 0.25f;
         p.ScaleRate = 0.5f;
         p.Velocity.X = -4 + 8.0f * (float)random.NextDouble();
         p.Velocity.Y = -8 + 4.0f * (float)random.NextDouble();
     }
 }