Example #1
0
        /// <summary>
        /// Computes the new location for the projectile
        /// </summary>
        public void MotionForProjectiles(Projectile projectile)
        {
            // if the projectile is not alive, don't move it
            if (!projectile.IsAlive())
            {
                return;
            }

            // find the velocity with respect to direction
            Vector2D velocity = projectile.GetDirection() * projectileSpeed;

            // reset the location of the projectile
            projectile.SetLocation(projectile.GetLocation() + velocity);
            if (!ProjectileOffScreen(projectile))
            {
                foreach (Star star in stars.Values)
                {
                    CollisionBetweenAStarAndProjectile(star, projectile);
                }
            }
        }