/// <summary>
 /// LoadContent will be called once per game and is the place to load
 /// all of your content.
 /// </summary>
 protected override void LoadContent()
 {
     // Create a new SpriteBatch, which can be used to draw textures.
     spriteBatch = new SpriteBatch(GraphicsDevice);
     MovingSprite ship = new MovingSprite(GraphicsDevice, "spaceShip", 1f);
     // TODO: use this.Content to load your game content here
 }
        public override void Update(float elapsedTime)
        {
            //Pull all moving sprites towards the star
            foreach (KeyValuePair <string, MovingSprite> kvp in movingSprites)
            {
                MovingSprite sprite = kvp.Value;

                //Get sprite and gravObject positions
                Vector2 gravObjectPos = new Vector2(this.x, this.y);
                Vector2 spritePos     = new Vector2(sprite.x, sprite.y);

                //Calculate direction vector between GravObject and sprite
                Vector2 dirVec = gravObjectPos - spritePos;

                //Find the distance between ship and Gravobject
                float distance = dirVec.Length();

                //Normalize the direction vector
                dirVec.Normalize();

                //Accelerate the ship toward the star
                float spritexAcc = dirVec.X * gravityStrength / distance;
                float spriteyAcc = dirVec.Y * gravityStrength / distance;

                //Update ship speed
                sprite.xSpeed += spritexAcc * elapsedTime;
                sprite.ySpeed += spriteyAcc * elapsedTime;

                //Update ship position
                sprite.x += sprite.xSpeed * elapsedTime;
                sprite.y += sprite.ySpeed * elapsedTime;
            }
        }
 public void AddtoAliens(string Key, MovingSprite sprite)
 {
     aliens.Add(Key, sprite);
 }
 public void AddtoMovingSprites(string Key, MovingSprite sprite)
 {
     movingSprites.Add(Key, sprite);
 }