Example #1
0
 public Wilderness(IServiceProvider service, Rectangle window)
 {
     mManger = new ContentManager(service, "Content");
     LoadWilderness();
     player = new Spaceship(new Vector2(356.0f, 429.0f), this, "Player");
     mWindow = window;
 }
Example #2
0
 /// <summary>
 /// 
 /// </summary>
 /// <returns></returns>
 private void CheckforChangeinWilderness(Spaceship player)
 {
     //I need to find a better way to do this logic
     if (player.LocalBounds.Intersects(this.mWindow))
     {
         return;
     }
     else
     {
         if (player.LocalBounds.Right >= 600)
         {
             direction = Directions.East;
         }
         else if (player.LocalBounds.Bottom >= 480)
         {
             direction = Directions.South;
         }
         else if (player.LocalBounds.Top <= 0)
         {
             direction = Directions.North;
         }
         else if (player.LocalBounds.Left <= 0)
         {
             direction = Directions.West;
         }
     }
 }
Example #3
0
        public void Update(GameTime time, MouseState state)
        {
            Spaceship player;
            foreach (GameObject obj in mObjects)
            {
                if (CheckForCollision(obj))
                {
                    //just take it out :)
                    //mObjects.Remove(obj);
                }

                //If its an enemy, then we tell him to figure out his next position
                if (obj.Name == "Enemy")
                {
                    Enemy enemy = (Enemy)obj;
                    enemy.ReactToGameObjects(mObjects);
                }
                obj.Update(time, state);
                if (obj.Name == "Player")
                {
                    //Get the player so we can check for a change in the wilderness
                    player = (Spaceship)obj;
                    CheckforChangeinWilderness(player);
                }
            }
            //I've updated the other stuff
            //CheckforChangeinWilderness();
            //player.Update(time, state);
        }