예제 #1
0
 public ThrownFood(Food f, Rectangle r, float Speed)
 {
     _Position = _INITAL_POSITION;
     _Texture = f._Texture;
     _Status = f._Status;
     _FoodDamage = f._FoodDamage;
     _Speed = Speed;
     _Bounds = r;
     UpdateRectangle();
 }
예제 #2
0
 public void Initialize(Vector2 _Position, Texture2D _Hole, Texture2D Enemy, Food[] _Food)
 {
     this._Food = _Food;
     this._Position = _Position;
     this._Texture = _Hole;
     this._Rectangle = new Rectangle((int)_Position.X, (int)_Position.Y, (int)_Texture.Width, (int)_Texture.Height);
     this._SingleEnemy = new Enemy();
     this._SingleEnemy.Initialize(_Position, Enemy);
     _Enemy = new List<Enemy>();
     deadEnemy = new List<Enemy>();
 }
예제 #3
0
        internal Enemy Clone(Food[] _F)
        {
            Enemy e = new Enemy();

            e._Position = _Position;
            e._Texture = _Texture;
            e._FoodList = _F;
            e.temp = new List<ThrownFood>();
            e._FoodThrown = new List<ThrownFood>();
            e.reset = 0;
            e._Status = EnemyStatus.Spawning;

            return e;
        }
예제 #4
0
 public void PickUp(KeyboardState ks, Food obj)
 {
     if (obj.HasFood() &&
         ks.IsKeyUp(Keys.Space) &&
         _Rec.Intersects(obj._Rectangle) &&
         !_hasThrownFood)
     {
         _hasThrownFood = !_hasThrownFood;
        _Food = new ThrownFood(obj.Clone(), _Bound, 6.5f);
     }
 }
예제 #5
0
        internal Food EnemyClone()
        {
            Food f = new Food();
            f._Texture = _Texture;
            f._FoodDamage = _FoodDamage;
            f._Status = FoodStatus.Thrown;
            _Amount--;

            return f;
        }
예제 #6
0
        internal Food Clone()
        {
            Food f = new Food();
            f._Texture = _Texture;
            f._Status = FoodStatus.Held;
            f._FoodDamage = _FoodDamage;
            _Amount--;

            return f;
        }
예제 #7
0
        /** private void FirstTimeSetup(int NumFood, int NumHoles)
         *  This funtion accepts two arguments: NumFood and NumHoles
         *  With these arguments it will display the number of food and holes will spawn
         *  This function will also create the objects necessary to play the game
         *  such as kathy, icecream, health, etc..
         */
        private void FirstTimeSetup(int NumFood, int NumHoles)
        {
            if (_Set) return;
            _Set = true;

            #region Kathy
            _kathy.SetPosition(new Vector2(_UI._Bounds.Right - 50, ((_UI._Bounds.Top + _UI._Bounds.Bottom) / 2) - 25));
            #endregion

            #region Texture Calling
            /*  Set Ground Banana Texture */
            Texture2D[] Banana = new Texture2D[7];
            Banana[0] = Content.Load<Texture2D>("Images/General/Pile");
            Banana[1] = Content.Load<Texture2D>("Images/Food/PileBanana/PileBanana1");
            Banana[2] = Content.Load<Texture2D>("Images/Food/PileBanana/PileBanana2");
            Banana[3] = Content.Load<Texture2D>("Images/Food/PileBanana/PileBanana3");
            Banana[4] = Content.Load<Texture2D>("Images/Food/PileBanana/PileBanana4");
            Banana[5] = Content.Load<Texture2D>("Images/Food/PileBanana/PileBanana5");
            Banana[6] = Content.Load<Texture2D>("Images/Food/PileBanana/PileBanana6");
            /*  Set Ground Pizza Texture */
            Texture2D[] Pizza = new Texture2D[7];
               Pizza[0] = Content.Load<Texture2D>("Images/General/Pile");
               Pizza[1] = Content.Load<Texture2D>("Images/Food/PilePizza/PilePizza1");
               Pizza[2] = Content.Load<Texture2D>("Images/Food/PilePizza/PilePizza2");
               Pizza[3] = Content.Load<Texture2D>("Images/Food/PilePizza/PilePizza3");
               Pizza[4] = Content.Load<Texture2D>("Images/Food/PilePizza/PilePizza4");
               Pizza[5] = Content.Load<Texture2D>("Images/Food/PilePizza/PilePizza5");
               Pizza[6] = Content.Load<Texture2D>("Images/Food/PilePizza/PilePizza6");
            /*  Set Ground Orange Texture */
            Texture2D[] Orange = new Texture2D[7];
               Orange[0] = Content.Load<Texture2D>("Images/General/Pile");
               Orange[1] = Content.Load<Texture2D>("Images/Food/PileOrange/PileOrange1");
               Orange[2] = Content.Load<Texture2D>("Images/Food/PileOrange/PileOrange2");
               Orange[3] = Content.Load<Texture2D>("Images/Food/PileOrange/PileOrange3");
               Orange[4] = Content.Load<Texture2D>("Images/Food/PileOrange/PileOrange4");
               Orange[5] = Content.Load<Texture2D>("Images/Food/PileOrange/PileOrange5");
               Orange[6] = Content.Load<Texture2D>("Images/Food/PileOrange/PileOrange6");

            Random rand = new Random();
            List<Texture2D[]> _FOOD = new List<Texture2D[]>();
            _FOOD.Add(Orange);
            _FOOD.Add(Pizza);
            _FOOD.Add(Banana);
            List<Texture2D> _SingleFOOD = new List<Texture2D>();
            _SingleFOOD.Add(Content.Load<Texture2D>("Images/Food/ThrownObject/Orange"));
            _SingleFOOD.Add(Content.Load<Texture2D>("Images/Food/ThrownObject/Pizza"));
            _SingleFOOD.Add(Content.Load<Texture2D>("Images/Food/ThrownObject/banana"));
            #endregion

            #region Food Value
            int[] health = new int[3];
            health[0] = 5;
            health[1] = 10;
            health[2] = 7;
            #endregion

            #region Food Spawn Location
            for (int i = 0; i < NumFood; ++i)
            {
                #region Food Declaraction
                Vector2 spawn = new Vector2(rand.Next(_UI.BoxWidth - 70) + 20, rand.Next(_UI.BoxHeight - 70) + 10) +
                    new Vector2((graphics.PreferredBackBufferWidth - _UI.BoxWidth) / 2, (graphics.PreferredBackBufferHeight - _UI.BoxHeight) / 2 + _UI.HorizontalBar.Height);
                Food f = new Food();
                int q = rand.Next(3);
                f.Initialize(spawn,
                    _FOOD[q],
                    _SingleFOOD[q],
                    rand.Next(5) + 2,
                    health[q]);
                #endregion

                #region Collision Check
                for (int j = 0; j < _foodList.Count; ++j )
                {
                    while (_foodList[j]._Rectangle.Intersects(f._Rectangle))
                    {
                        spawn = new Vector2(rand.Next(_UI.BoxWidth - 70) + 20, rand.Next(_UI.BoxHeight - 70) + 10) +
                        new Vector2((graphics.PreferredBackBufferWidth - _UI.BoxWidth) / 2, (graphics.PreferredBackBufferHeight - _UI.BoxHeight) / 2 + _UI.HorizontalBar.Height);
                        f.SetPosition(spawn);
                        j = 0;
                    }
                }
                #endregion

                _foodList.Add(f);
            }
            #endregion

            #region Food
            Food[] ef = new Food[3];
            ef[0] = new Food();
            ef[1] = new Food();
            ef[2] = new Food();
            ef[0].EnemyInitialize(_SingleFOOD[0], 256, 5);
            ef[1].EnemyInitialize(_SingleFOOD[1], 256, 10);
            ef[2].EnemyInitialize(_SingleFOOD[2], 256, 7);
            #endregion

            #region Hole Spawn Location
            for (int i = 0; i < NumHoles; ++i)
            {
                #region Hole Declaration
                Vector2 spawn = new Vector2(rand.Next(_UI.BoxWidth - 70) + 20, rand.Next(_UI.BoxHeight - 70) + 10) +
                    new Vector2((graphics.PreferredBackBufferWidth - _UI.BoxWidth) / 2, (graphics.PreferredBackBufferHeight - _UI.BoxHeight) / 2 + _UI.HorizontalBar.Height);
                Hole hole = new Hole();
                hole.Initialize(spawn,
                    Content.Load<Texture2D>("Images/General/Hole"),
                    Content.Load<Texture2D>("Images/Character/Chef"),
                    ef);
                #endregion

                #region Collision Check
                bool clear = false;
                while (!clear)
                {
                    clear = true;

                    #region Check if spawns on food
                    for (int j = 0; j < _foodList.Count; ++j)
                   {
                        while (_foodList[j]._Rectangle.Intersects(hole._Rectangle))
                        {
                            spawn = new Vector2(rand.Next(_UI.BoxWidth - 70) + 20, rand.Next(_UI.BoxHeight - 70) + 10) +
                            new Vector2((graphics.PreferredBackBufferWidth - _UI.BoxWidth) / 2, (graphics.PreferredBackBufferHeight - _UI.BoxHeight) / 2 + _UI.HorizontalBar.Height);
                            hole.SetPosition(spawn);
                            j = 0;
                        }
                   }
                    #endregion

                    #region Check if hole collides with another whole
                    for (int j = 0; j < _holeList.Count; ++j)
                    {
                        while (_holeList[j]._Rectangle.Intersects(hole._Rectangle))
                        {
                            spawn = new Vector2(rand.Next(_UI.BoxWidth - 70) + 20, rand.Next(_UI.BoxHeight - 70) + 10) +
                            new Vector2((graphics.PreferredBackBufferWidth - _UI.BoxWidth) / 2, (graphics.PreferredBackBufferHeight - _UI.BoxHeight) / 2 + _UI.HorizontalBar.Height);
                            hole.SetPosition(spawn);
                            j = 0;
                            clear = false;
                        }
                       if (!clear)
                            break;
                    }
                    #endregion
                }
                #endregion

                _holeList.Add(hole);
            }
            #endregion

            #region IceCream
            Texture2D IceCreamCone = Content.Load<Texture2D>("Images/Food/IceCreamCone/IceCream");
            _IceCreamCone.Initialize(new Vector2(_UI._Bounds.Left, rand.Next(_UI.BoxHeight) + _UI._Bounds.Top), IceCreamCone, 24);
            #endregion

            #region Only First Level
            if (level == 1)
            {
                #region Mouse
                _Mouse = new Cursor();
                _Mouse.Initialize(Content.Load<Texture2D>("Images/Cursor/Cursor"));
                #endregion

                #region Text
                _LevelAnnounce = new Text("", new Vector2(graphics.PreferredBackBufferWidth / 3, 20));
                _Points = new Text("000", new Vector2(55, 20));
                _TextList.Add(_Points);
                _TextList.Add(_LevelAnnounce);
                #endregion
            }
            #endregion
        }
예제 #8
0
        protected override void Initialize()
        {
            base.Initialize();

            #region UI
            _UI = new UI();
            _UI.Initialize(Content, graphics, 96, 90);
            #endregion

            #region Kathy
            _kathy = new Character(Content.Load<Texture2D>("Images/Character/Kathy"), _UI._Bounds, 5, 200);
            #endregion

            #region Holes
            _holeList = new List<Hole>();
            #endregion

            #region Food
            _foodList = new List<Food>();
            #endregion

            #region Audio
            _Audio = new Audio();
            _Audio.Initialize();
            #endregion

            #region Text
            _TextList = new List<Text>();
            #endregion

            #region HealthBar
            _HealthBar = new HealthBar();
            _HealthBar.Initialize(Content.Load<Texture2D>("Images/HealthBar/HealthBar"), new Vector2(graphics.PreferredBackBufferWidth - 55, 0) ,_kathy.GetHealth(), _UI.BoxHeight);
            #endregion

            #region Ice Cream
            _IceCreamCone = new Food();
            #endregion
        }