public SpecialCollectable(Texture2D _Tex, Point _Position, Player _Player1, Opponent _Player2, int PitchWidth, int PitchHeight)
        {
            Player1 = _Player1;
            Player2 = _Player2;
            Tex = _Tex;
            Position = _Position;
            Health = 10;
            Speed = 12;
            MiddlePoint = new Point(Tex.Width / 2, Tex.Height / 2);

            QuadrantAmountX = (int)Math.Sqrt(AmountOfQuadrants);
            QuadrantAmountY = (int)Math.Sqrt(AmountOfQuadrants);

            int QuadrantWidth = (PitchWidth / QuadrantAmountX);
            int QuadrantHeight = (PitchHeight / QuadrantAmountY);

            int QuadrantX = -(PitchWidth / 2) + (QuadrantWidth/2);
            int QuadrantY = -(PitchHeight / 2) + (QuadrantHeight/2);
            int QuadListValue = 0;
            //Set Quadrant Positions
            for(int j = 0; j < QuadrantAmountY; j++)
            {
                for (int i = 0; i < QuadrantAmountX; i++)
                {
                    QuadrantList.Add(new Quadrant(new Vector2(QuadrantX, QuadrantY), QuadrantWidth, QuadrantHeight,i,j));
                    GridPosition.Add(new Vector2(i, j), QuadListValue);
                    QuadListValue++;
                    QuadrantX += QuadrantWidth;
                }
                QuadrantX = -(PitchWidth / 2) + (QuadrantWidth / 2);
                QuadrantY += QuadrantHeight;
            }
            DrawRectangle = new Rectangle(Position.X, Position.Y, Tex.Width, Tex.Height);
        }
예제 #2
0
        public void InitializeGamePlay()
        {
            Vector2 Player1Position;
            Vector2 EnemyPosition;
            if (PlayerID == "Player1")
            {
                Player1Position = new Vector2(-200, 0) - new Vector2((MessiTex[0].Width/3)/2,MessiTex[0].Height/2);
                EnemyPosition = new Vector2(200, 0) - new Vector2((MessiTex[0].Width / 3) / 2, MessiTex[0].Height / 2);

            }
            else
            {
                Player1Position = new Vector2(200, 0) - new Vector2((MessiTex[0].Width / 3) / 2, MessiTex[0].Height / 2); ;
                EnemyPosition = new Vector2(-200, 0) - new Vector2((MessiTex[0].Width / 3) / 2, MessiTex[0].Height / 2); ;
            }
            if (MessiSelected)
            {

                Player1 = new Player(MessiTex, Player1Position, 3, "Messi", PlayerID, this);
            }
            else
            {

                Player1 = new Player(RonaldoTex, Player1Position, 3, "Ronaldo", PlayerID, this);
            }
            if (OpponentMessiSelected)
            {
                Player2 = new Opponent(MessiTex, EnemyPosition, 3, CollectableList, this);
            }
            else
            {
                Player2 = new Opponent(RonaldoTex, EnemyPosition, 3, CollectableList, this);
            }
        }