Example #1
0
        public bool meeplePlacement(KeyboardState newState, KeyboardState oldState, ref Meeple[] meeples)
        {
            if (meepleNum == 4)
            {
                meepleNum = 0;
                currentRound.meeplesPlaced = true;
            }
            Meeple meeple = currentMeeple(ref meeples);

            if (!meeple.placed)
            {
                if (oldState.IsKeyUp(Keys.D1) && newState.IsKeyDown(Keys.D1) && !pressedKeys[0])
                {
                    meeple.positionAdder      = 2;
                    meeple.positionMultiplier = 0;
                    meeple.placed             = true;
                    pressedKeys[0]            = true;
                    players[playerAtTurn - 1].playerHand[players[playerAtTurn - 1].numInHand] = 0;
                    players[playerAtTurn - 1].incrementHand();
                    return(true);
                }
                else if (oldState.IsKeyUp(Keys.D2) && newState.IsKeyDown(Keys.D2) && !pressedKeys[1])
                {
                    meeple.positionAdder      = 2;
                    meeple.positionMultiplier = 1;
                    meeple.placed             = true;
                    pressedKeys[1]            = true;
                    players[playerAtTurn - 1].playerHand[players[playerAtTurn - 1].numInHand] = 1;
                    players[playerAtTurn - 1].incrementHand();
                    return(true);
                }
                else if (oldState.IsKeyUp(Keys.D3) && newState.IsKeyDown(Keys.D3) && !pressedKeys[2])
                {
                    meeple.positionAdder      = 2;
                    meeple.positionMultiplier = 2;
                    meeple.placed             = true;
                    pressedKeys[2]            = true;
                    players[playerAtTurn - 1].playerHand[players[playerAtTurn - 1].numInHand] = 2;
                    players[playerAtTurn - 1].incrementHand();
                    return(true);
                }
                else if (oldState.IsKeyUp(Keys.D4) && newState.IsKeyDown(Keys.D4) && !pressedKeys[3])
                {
                    meeple.positionAdder      = 2;
                    meeple.positionMultiplier = 3;
                    meeple.placed             = true;
                    pressedKeys[3]            = true;
                    players[playerAtTurn - 1].playerHand[players[playerAtTurn - 1].numInHand] = 3;
                    players[playerAtTurn - 1].incrementHand();
                    return(true);
                }
            }
            return(false);
        }
Example #2
0
 public String DrawMeeples(ref Rectangle positionAndSize, int tileSize, Meeple meeple)
 {
     positionAndSize.X = (19 + meeple.positionAdder) * tileSize;
     positionAndSize.Y = meeple.positionMultiplier * tileSize;
     if (meeple.playerNumber == 1)
     {
         return("K1");
     }
     else
     {
         return("K3");
     }
 }
Example #3
0
        protected override void Initialize()
        {
            graphics.PreferredBackBufferWidth  = 1760;
            graphics.PreferredBackBufferHeight = 640;

            Window.AllowUserResizing = true;
            IsMouseVisible           = true;
            graphics.ApplyChanges();
            oldState                 = Keyboard.GetState();
            meeples                  = new Meeple[4];
            meeples[0]               = new Meeple(0, 2, 2, 1, 2);
            meeples[1]               = new Meeple(0, 0, 1, 2, 0);
            meeples[2]               = new Meeple(0, 3, 2, 3, 3);
            meeples[3]               = new Meeple(0, 1, 1, 4, 1);
            players                  = new Player[2];
            players[0]               = new Player();
            players[1]               = new Player();
            deckButtonMover          = 0;
            whereInDeck              = 8;
            deckButton1              = 0;
            deckButton2              = 1;
            deckButton3              = 2;
            deckButton4              = 3;
            deckButton5              = 4;
            deckButton6              = 5;
            deckButton7              = 6;
            deckButton8              = 7;
            deckBuffer               = 8;
            deckSize                 = 24;
            deckPositionY1           = 0;
            deckPositionY2           = 1;
            deckPositionY3           = 2;
            deckPositionY4           = 3;
            deckPositionX1           = 20;
            totalNumberOfTilesPlaced = 0;

            square  = new Texture2D(GraphicsDevice, 100, 100);
            square2 = new Texture2D(GraphicsDevice, 100, 100);
            square.CreateBorder(5, Color.Red);
            square2.CreateBorder(5, Color.Red);

            playerX   = 0;
            playerY   = 0;
            playerX2  = 1;
            playerY2  = 0;
            rotateDeg = 0;
            base.Initialize();
            numberOfTilesPlaced = 0;
            gameEnd             = new GameEndLogic();
        }
Example #4
0
 public void DrawMeeples(Meeple meeple)
 {
     meeple.meepleIcon = viewLogic.DrawMeeples(ref positionAndSize, tileSize, meeple);
     tileTexture       = Content.Load <Texture2D>(meeple.meepleIcon);
     spriteBatch.Draw(tileTexture, positionAndSize, Color.White);
 }