Beispiel #1
0
 /// <summary>
 /// Set ship acceleration to non-zero.  Ship also produces particle streams.
 /// </summary>
 public void ThrottleOn()
 {
     accX = maxAcceleration * (float)Math.Cos((rotate + 90) * Math.PI / 180);
     accY = maxAcceleration * (float)Math.Sin((rotate + 90) * Math.PI / 180);
     shipStream.AddParticles(posX, posY, rotate, 10, 10, 5, 2, 8);
     shipStream.AddParticles(posX, posY, rotate, 10, 10, 5, 5, 5);
     shipStream.AddParticles(posX, posY, rotate, 10, 10, 5, 20, 2);
 }
Beispiel #2
0
        /// <summary>
        /// Determines physics for projectiles and its particles for the frame.
        /// Projectile is removed if it travels off screen.
        /// </summary>
        /// <param name="width"></param>
        /// <param name="height"></param>
        private void CalculateProjectiles(int width, int height)
        {
            projectileStream.CalculateParticles(DELTA_PROJECTILE_STREAM);

            // determine projectiles
            for (int i = 0; i < projectiles.Count; i++)
            {
                // projectile[i][0] = X position of projectile, [1] = Y position of projectile, [2] = rotation of projectile
                projectiles[i][0] += projectiles[i][4];
                projectiles[i][1] += projectiles[i][5];
                projectileStream.AddParticles(projectiles[i][0], projectiles[i][1], 0, 0, 3, 1, 2, 1);
                projectileStream.AddParticles(projectiles[i][0], projectiles[i][1], 0, 0, 3, 1, 2, 3);
                projectileStream.AddParticles(projectiles[i][0], projectiles[i][1], 0, 0, 3, 1, 1, 5);

                if ((projectiles[i][0] < 0) || (projectiles[i][0] > width) || (projectiles[i][1] < 0) || (projectiles[i][1] > height))
                {
                    projectiles.RemoveAt(i);
                }
            }
        }
Beispiel #3
0
 public void Emit(int count)
 {
     Particles.AddParticles(ParticleGenerator(count));
 }