Beispiel #1
0
 public Ranger(Game game, int xLoc, int yLoc, int playerIndex)
     : base(game, xLoc, yLoc)
 {
     walk = new Texture2D[2];
     attack = new Texture2D[2];
     map = (BattleMap)game.Services.GetService(typeof(BattleMap));
     gameStateManager = (GameStateManager)game.Services.GetService(typeof(GameStateManager));
     this.Move(xLoc, yLoc);
     PlayerIndex = playerIndex;
     HasMoved = true;
     HasAttacked = true;
     MoveDistance = 3;
     HealthPoints = 15;
     CurrentHealth = HealthPoints;
     Strength = 10;
     PDefense = 7;
     Dexterity = 13;
     AttackRange = 3;
     Alive = true;
     CharType = "mercenary";
     Cost = 100;
     Attacked = 0;
     championCommander = GetChampionCommander((List<Character>)game.Services.GetService(typeof(List<Character>)), this);
     Level = 1;
     Experience = 0;
 }
Beispiel #2
0
        public SelectScreen(Game game, Character character)
        {
            playerManager = (PlayerManager)game.Services.GetService(typeof(PlayerManager));
            map = (BattleMap)game.Services.GetService(typeof(BattleMap));
            selectedChar = character;

            const string usageText = "";
            this.message = message + usageText;
            if (selectedChar == null)
            {
                //this.message = "";
            }
            else
            {
                this.message += "LVL: " + selectedChar.Level + " "
                                + "HP: " + selectedChar.CurrentHealth + "/" + selectedChar.HealthPoints + " "
                                + "STR: " + selectedChar.Strength + " "
                                + "DEX: " + selectedChar.Dexterity + " "
                                + "INT: " + selectedChar.Intelligence + "\n"
                                + "PDEF: " + selectedChar.PDefense + " "
                                + "MDEF: " + selectedChar.MDefense + " "
                                + "EXP: " + selectedChar.Experience;
                if (selectedChar.CharType == "champion") message += " Gold: " + selectedChar.Gold;
            }
            IsPopup = true;

            TransitionOnTime = TimeSpan.FromSeconds(0.2);
            TransitionOffTime = TimeSpan.FromSeconds(0.2);
        }
Beispiel #3
0
        /// <summary>
        /// Draws the background screen.
        /// </summary>
        public override void Draw(GameTime gameTime)
        {
            SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
            Viewport viewport = ScreenManager.GraphicsDevice.Viewport;
            Rectangle fullscreen = new Rectangle(0, 0, viewport.Width, viewport.Height);

            spriteBatch.Begin();

            spriteBatch.Draw(backgroundTexture, fullscreen,
                             new Color(TransitionAlpha, TransitionAlpha, TransitionAlpha));

            spriteBatch.End();

            if (gameStateManager.State == GameState.combatOver || gameStateManager.State == GameState.gameOver)
            {
                foreach (Character character in charList)
                {
                    character.Attacked = 0;
                    character.Attacking = 0;
                }
                attackedCharacter = null;
                attackingCharacter = null;
                ExitScreen();
                gameStateManager.State = GameState.playing;
            }
        }
Beispiel #4
0
 public SpiritPriest(Game game, int xLoc, int yLoc, int playerIndex)
     : base(game, xLoc, yLoc)
 {
     walk = new Texture2D[2];
     attack = new Texture2D[2];
     heal = new Texture2D[3];
     map = (BattleMap)game.Services.GetService(typeof(BattleMap));
     gameStateManager = (GameStateManager)game.Services.GetService(typeof(GameStateManager));
     /*Initialize();
     LoadContent();*/
     this.Move(xLoc, yLoc);
     PlayerIndex = playerIndex;
     HasMoved = true;
     HasAttacked = true;
     MoveDistance = 2;
     HealthPoints = 15;
     CurrentHealth = HealthPoints;
     Strength = 6;
     PDefense = 8;
     MDefense = 14;
     Dexterity = 8;
     Intelligence = 14;
     AttackRange = 3;
     Alive = true;
     CharType = "mercenary";
     Cost = 150;
     Attacked = 0;
     championCommander = GetChampionCommander((List<Character>)game.Services.GetService(typeof(List<Character>)), this);
     Level = 1;
     Experience = 0;
 }
Beispiel #5
0
 /// <summary>
 /// Constructor.
 /// </summary>
 public BattleScreen(Game game, Character attacking, Character attacked)
 {
     TransitionOnTime = TimeSpan.FromSeconds(0.5);
     TransitionOffTime = TimeSpan.FromSeconds(0.5);
     attackingCharacter = attacking;
     attackedCharacter = attacked;
     gameStateManager = (GameStateManager)game.Services.GetService(typeof(GameStateManager));
     charList = (List<Character>)game.Services.GetService(typeof(List<Character>));
 }
Beispiel #6
0
 public void GetChampionMove(Character character)
 {
     if (character.Gold >= 100)
     {
         MoveToCamp(character);
     }
     else
     {
         MoveToEnemy(character);
     }
 }
Beispiel #7
0
 public void GetMove(Character character, GameTime gameTime)
 {
     if (character.CharType == "champion")
     {
         GetChampionMove(character);
     }
     else
     {
         GetMercenaryMove(character);
     }
 }
Beispiel #8
0
        public PopupScreen(Game game, Character character)
        {
            cursor = (Cursor)game.Services.GetService(typeof(Cursor));
            playerManager = (PlayerManager)game.Services.GetService(typeof(PlayerManager));
            screenManager = (ScreenManager)game.Services.GetService(typeof(ScreenManager));
            map = (BattleMap)game.Services.GetService(typeof(BattleMap));
            gameStateManager = (GameStateManager)game.Services.GetService(typeof(GameStateManager));

            selectedChar = character;
            selectScreen = new SelectScreen(game, character);
            screenManager.AddScreen(selectScreen, null);

            const string usageText = "A: Move" + "\nX: Attack" + "\nStart: End Turn" + "\nB: Cancel";
            this.message = message + usageText;
            if (selectedChar == null)
            {
                this.message = "Start: End Turn" + "\nB: Cancel";
            }
            else if (selectedChar.CharType == "champion")
            {
                this.message += "\nY: Buy Mercenary";
            }
            IsPopup = true;

            TransitionOnTime = TimeSpan.FromSeconds(0.2);
            TransitionOffTime = TimeSpan.FromSeconds(0.2);

                menuMove = new InputAction(
                    new Buttons[] { Buttons.A },
                    new Keys[] { Keys.A },
                    true);
                menuAttack = new InputAction(
                    new Buttons[] { Buttons.X, },
                    new Keys[] { Keys.X },
                    true);
                menuCancel = new InputAction(
                    new Buttons[] { Buttons.B, },
                    new Keys[] { Keys.B },
                    true);
                menuEndTurn = new InputAction(
                    new Buttons[] { Buttons.Start, },
                    new Keys[] { Keys.Enter },
                    true);
                menuBuy = new InputAction(
                    new Buttons[] { Buttons.Y, },
                    new Keys[] { Keys.Y },
                    true);
        }
Beispiel #9
0
        public void AttackHelper(Character character)
        {
            attackFlag = 1;
            attackingCharacter = character;

            Vector2 charPos = attackingCharacter.getPosition();

            for (int i = 0; i < map.getHeight(); i++)
            {
                for (int j = 0; j < map.getWidth(); j++)
                {

                    if (((Math.Abs((int)charPos.Y / 60 - j)) + (Math.Abs((int)charPos.X / 60 - i))) <= attackingCharacter.AttackRange)
                    {
                        map.GetSquare(i, j).IsAttackable = true;
                    }
                }
            }
        }
Beispiel #10
0
        public BuyScreen(Game game, Character character)
            : base("Hire a Mercenary")
        {
            cursor = (Cursor)game.Services.GetService(typeof(Cursor));
            playerManager = (PlayerManager)game.Services.GetService(typeof(PlayerManager));
            map = (BattleMap)game.Services.GetService(typeof(BattleMap));
            charList = (List<Character>)game.Services.GetService(typeof(List<Character>));
            screenManager = (ScreenManager)game.Services.GetService(typeof(ScreenManager));
            champion = character;
            this.game = game;

            MenuEntry buyKnight = new MenuEntry("Hire Knight, Cost: 100");
            MenuEntry buyRanger = new MenuEntry("Hire Ranger, Cost: 100");
            MenuEntry buyBarbarian = new MenuEntry("Hire Barbarian, Cost: 100");
            MenuEntry buyMage = new MenuEntry("Hire Mage, Cost: 150");
            MenuEntry buyPriest = new MenuEntry("Hire Spirit Priest, Cost: 150");
            MenuEntry cancel = new MenuEntry("Cancel");
            gameStateManager = (GameStateManager)game.Services.GetService(typeof(GameStateManager));

            gameStateManager.State = GameState.buying;
            // Hook up menu event handlers.
            buyKnight.Selected += buyKnightSelected;
            buyRanger.Selected += buyRangerSelected;
            buyBarbarian.Selected += buyBarbarianSelected;
            buyMage.Selected += buyMageSelected;
            buyPriest.Selected += buyPriestSelected;
            cancel.Selected += cancelSelected;

            // Add entries to the menu.
            MenuEntries.Add(buyKnight);
            MenuEntries.Add(buyRanger);
            MenuEntries.Add(buyBarbarian);
            MenuEntries.Add(buyMage);
            MenuEntries.Add(buyPriest);
            MenuEntries.Add(cancel);

            /*if (aiFlag == true)
            {
                BuyRandom();
            }*/
        }
Beispiel #11
0
        public void ClearBoard()
        {
            moveFlag = 0;
            buttonFlag = 0;
            attackFlag = 0;
            movingCharacter = null;
            attackFlag = 0;
            attackingCharacter = null;
            attackedCharacter = null;
            selectedCharacter = null;

            for (int i = 0; i < map.getHeight(); i++)
            {
                for (int j = 0; j < map.getWidth(); j++)
                {
                    map.GetSquare(i, j).IsMovable = false;
                    map.GetSquare(i, j).IsAttackable = false;
                }
            }
        }
Beispiel #12
0
 public void setCurrentChar(Character character)
 {
     currentChar = character;
 }
Beispiel #13
0
 public void GetMercenaryMove(Character character)
 {
     MoveToEnemy(character);
     AttackEnemy(character);
 }
Beispiel #14
0
        private void MoveToEnemy(Character character)
        {
            Character closestEnemy =  charList[0];
            int minDistance = (int)Math.Sqrt(((int)character.getPosition().Y / 60 - (int)closestEnemy.getPosition().Y / 60) * ((int)character.getPosition().Y / 60 - (int)closestEnemy.getPosition().Y / 60) - ((int)character.getPosition().X / 60 - (int)closestEnemy.getPosition().X / 60) * ((int)character.getPosition().X / 60 - (int)closestEnemy.getPosition().X) / 60);

            for (int i = 0; i < map.getHeight(); i++)
            {
                for (int j = 0; j < map.getWidth(); j++)
                {
                    if (map.GetSquare(i, j).getCurrentChar() != null && map.GetSquare(i, j).getCurrentChar().PlayerIndex == 1)
                    {
                        Character temp = map.GetSquare(i, j).getCurrentChar();
                        int distance = (int)Math.Sqrt(((int)character.getPosition().Y / 60 - (int)temp.getPosition().Y / 60) * ((int)character.getPosition().Y / 60 - (int)temp.getPosition().Y / 60) - ((int)character.getPosition().X / 60 - (int)temp.getPosition().X / 60) * ((int)character.getPosition().X / 60 - (int)temp.getPosition().X / 60));

                        if (distance < minDistance)
                        {
                            closestEnemy = temp;
                            minDistance = distance;
                        }
                    }
                }
            }

            if (character.HasMoved == false)
            {
                cursor.MoveHelper(character);
                int distance = 9000;
                Vector2 toMove = new Vector2();

                for (int i = 0; i < map.getHeight(); i++)
                {
                    for (int j = 0; j < map.getWidth(); j++)
                    {
                        if (map.GetSquare(i, j).IsMovable == true)
                        {
                            int distanceToEnemy = (int)Math.Sqrt(Math.Pow((int)j - ((int)closestEnemy.getPosition().Y / 60), 2) + Math.Pow((int)i - ((int)closestEnemy.getPosition().X / 60), 2));

                            if (distanceToEnemy < distance)
                            {
                                if(distanceToEnemy >= 1)
                                {
                                    distance = distanceToEnemy;
                                    toMove.X = i;
                                    toMove.Y = j;
                                }
                            }
                        }
                    }
                }
                character.Move((int)toMove.X, (int)toMove.Y);
                character.HasMoved = true;

                cursor.ClearBoard();
            }
        }
Beispiel #15
0
        void BuyRandom(Character champion)
        {
            Random random = new Random();
            int num;

            if (champion.Gold >= 150) num = random.Next(0, 4);
            else num = random.Next(0, 2);

            switch (num)
            {
                case 0:
                    new BuyScreen(game, champion).buyKnightSelected(null, null);
                    break;
                case 1:
                    new BuyScreen(game, champion).buyRangerSelected(null, null);
                    break;
                case 2:
                    new BuyScreen(game, champion).buyBarbarianSelected(null, null);
                    break;
                case 3:
                    new BuyScreen(game, champion).buyMageSelected(null, null);
                    break;
                case 4:
                    new BuyScreen(game, champion).buyPriestSelected(null, null);
                    break;
            }
        }
Beispiel #16
0
        private void MoveToCamp(Character character)
        {
            Vector2 campPosition;
            Vector2 minCampPosition = new Vector2(); ;
            int minCampDistance = 9000;
            Character nearbyCamp;

            foreach (Character camp in charList)
            {
                if (camp.CharType == "camp")
                {
                    campPosition = camp.getPosition();
                    campPosition.X = (int)campPosition.X / 60;
                    campPosition.Y = (int)campPosition.Y / 60;

                    if ((int)Math.Sqrt((campPosition.X * campPosition.X) + (campPosition.Y * campPosition.Y)) < minCampDistance)
                    {
                        minCampPosition = campPosition;
                        nearbyCamp = camp;
                    }
                }
            }

            cursor.MoveHelper(character);

            int minDistance = 9000;
            Vector2 toMove = new Vector2();
            for (int i = 0; i < map.getHeight(); i++)
            {
                for (int j = 0; j < map.getWidth(); j++)
                {
                    if (map.GetSquare(i, j).IsMovable == true)
                    {
                        int distanceToCamp = (int)Math.Sqrt(Math.Abs((i - minCampPosition.Y) * (i - minCampPosition.Y)) - Math.Abs((j - minCampPosition.X) * (j - minCampPosition.X)));

                        if (distanceToCamp < minDistance)
                        {
                            minDistance = distanceToCamp;
                            toMove.X = j;
                            toMove.Y = i;
                        }
                    }
                }
            }

            if (character.HasMoved == false)
            {
                character.Move((int)toMove.Y, (int)toMove.X);
                character.HasMoved = true;

                //map.GetSquare((int)character.getPosition().Y / 60, (int)character.getPosition().X / 60).TileDeselect();
                cursor.ClearBoard();

                if ((int)(character.getPosition().X / 60) + 1 < 10 && map.GetSquare((int)(character.getPosition().Y / 60), (int)(character.getPosition().X / 60) + 1).getCurrentChar() != null)
                {
                    if (map.GetSquare((int)(character.getPosition().Y / 60), (int)(character.getPosition().X / 60) + 1).getCurrentChar().CharType == "camp")
                    {
                        BuyMercenary(character);
                    }
                }
                if ((int)(character.getPosition().Y / 60) - 1 >= 0 && map.GetSquare((int)(character.getPosition().Y / 60) - 1, (int)(character.getPosition().X / 60)).getCurrentChar() != null)
                {
                    if (map.GetSquare((int)(character.getPosition().Y / 60) - 1, (int)(character.getPosition().X / 60)).getCurrentChar().CharType == "camp")
                    {
                        BuyMercenary(character);
                    }
                }
                if ((int)(character.getPosition().X / 60) - 1 >= 0 && map.GetSquare((int)(character.getPosition().Y / 60), (int)(character.getPosition().X / 60) - 1).getCurrentChar() != null)
                {
                    if (map.GetSquare((int)(character.getPosition().Y / 60), (int)(character.getPosition().X / 60) - 1).getCurrentChar().CharType == "camp")
                    {
                        BuyMercenary(character);
                    }
                }
                if ((character.getPosition().Y / 60) + 1 < 10 && map.GetSquare((int)(character.getPosition().Y / 60) + 1, (int)(character.getPosition().X / 60)).getCurrentChar() != null)
                {
                    if (map.GetSquare((int)(character.getPosition().Y / 60) + 1, (int)(character.getPosition().X / 60)).getCurrentChar().CharType == "camp")
                    {
                        BuyMercenary(character);
                    }
                }
            }
        }
Beispiel #17
0
 private void BuyMercenary(Character character)
 {
     for (int i = 0; i < 2; i++)
     {
         BuyRandom(character);
     }
 }
Beispiel #18
0
        private void AttackEnemy(Character character)
        {
            Character lowHealth = null;

            if (character.HasAttacked == false)
            {
                cursor.AttackHelper(character);
                for (int i = 0; i < map.getHeight(); i++)
                {
                    for (int j = 0; j < map.getWidth(); j++)
                    {
                        if (map.GetSquare(j, i).IsAttackable && map.GetSquare(j, i).getCurrentChar() != null)
                        {
                            if(character.GetType() == typeof(SpiritPriest))
                            {
                                if (map.GetSquare(j, i).getCurrentChar().PlayerIndex == 2)
                                {
                                    Character temp = map.GetSquare(j, i).getCurrentChar();

                                    if (lowHealth == null)
                                    {
                                        lowHealth = temp;
                                    }
                                    else if (temp.CurrentHealth < lowHealth.CurrentHealth)
                                    {
                                        lowHealth = temp;
                                    }
                                }
                            }

                            else if (map.GetSquare(j, i).getCurrentChar().PlayerIndex == 1)
                            {
                                Character temp = map.GetSquare(j, i).getCurrentChar();

                                if (lowHealth == null)
                                {
                                    lowHealth = temp;
                                }
                                else if (temp.CurrentHealth < lowHealth.CurrentHealth)
                                {
                                    lowHealth = temp;
                                }
                            }
                        }
                    }
                }

                cursor.ClearBoard();

                if (lowHealth != null)
                {
                    gameStateManager.State = GameState.combat;
                    character.Attack((int)lowHealth.getPosition().Y / 60, (int)lowHealth.getPosition().X / 60);
                    character.HasAttacked = true;
                    character.Attacking = 1;
                    lowHealth.Attacked = 1;
                    screenManager.AddScreen(new BattleScreen(game, character, lowHealth), null);
                }
            }
        }
Beispiel #19
0
 protected Character GetChampionCommander(List<Character> charList, Character thisChar)
 {
     foreach (Character character in charList)
     {
         if (character.PlayerIndex == thisChar.PlayerIndex && character.CharType == "champion")
         {
             Character championCommander = character;
             return championCommander;
         }
     }
     return null;
 }
Beispiel #20
0
        public void MoveHelper(Character character)
        {
            moveFlag = 1;
            movingCharacter = character;

            Vector2 charPos = movingCharacter.getPosition();

            for (int i = 0; i < map.getHeight(); i++)
            {
                for (int j = 0; j < map.getWidth(); j++)
                {
                    if (((Math.Abs((int)charPos.Y / 60 - j)) + (Math.Abs((int)charPos.X / 60 - i))) <= movingCharacter.MoveDistance
                        && map.GetSquare(j,i).getCurrentChar() == null)
                    {
                        map.GetSquare(i, j).IsMovable = true;
                    }
                }
            }
        }
Beispiel #21
0
        public override void Update(GameTime gameTime)
        {
            if (gameStateManager.State == GameState.playing)
            {
                currentButtonState = GamePad.GetState(PlayerIndex.One);
                currentKeyState = Keyboard.GetState(PlayerIndex.One);

                if ((currentButtonState.DPad.Left == ButtonState.Pressed || currentButtonState.ThumbSticks.Left.X < 0 || currentKeyState.IsKeyDown(Keys.Left)))
                {
                    currentTile.TileDeselect();
                    pos.X -= 60;

                    if (buttonFlag == 0)
                    {
                        buttonFlag = 1;
                    }
                    if ((currentButtonState.DPad.Left == ButtonState.Pressed && oldButtonState.DPad.Left == ButtonState.Pressed) || (currentKeyState.IsKeyDown(Keys.Left) && oldKeyState.IsKeyDown(Keys.Left)))
                    {
                        pos.X += 60;
                    }
                    else
                    {
                        buttonFlag = 0;
                    }

                    if (pos.X < 0) pos.X = 20;
                    currentTile = SelectTile((int)pos.Y / 60, (int)pos.X / 60);
                }

                if ((currentButtonState.DPad.Right == ButtonState.Pressed || currentButtonState.ThumbSticks.Left.X > 0 || currentKeyState.IsKeyDown(Keys.Right)))
                {
                    currentTile.TileDeselect();
                    pos.X += 60;

                    if (buttonFlag == 0)
                    {
                        buttonFlag = 1;
                    }
                    if ((currentButtonState.DPad.Right == ButtonState.Pressed && oldButtonState.DPad.Right == ButtonState.Pressed) || (currentKeyState.IsKeyDown(Keys.Right) && oldKeyState.IsKeyDown(Keys.Right)))
                    {
                        pos.X -= 60;
                    }
                    else
                    {
                        buttonFlag = 0;
                    }

                    if ((int)pos.X / 60 > map.getWidth() - 1) pos.X -= 60;
                    currentTile = SelectTile((int)pos.Y / 60, (int)pos.X / 60);
                }

                if ((currentButtonState.DPad.Up == ButtonState.Pressed || currentButtonState.ThumbSticks.Left.Y > 0 || currentKeyState.IsKeyDown(Keys.Up)))
                {
                    currentTile.TileDeselect();
                    pos.Y -= 60;

                    if (buttonFlag == 0)
                    {
                        buttonFlag = 1;
                    }
                    if ((currentButtonState.DPad.Up == ButtonState.Pressed && oldButtonState.DPad.Up == ButtonState.Pressed) || (currentKeyState.IsKeyDown(Keys.Up) && oldKeyState.IsKeyDown(Keys.Up)))
                    {
                        pos.Y += 60;
                    }
                    else
                    {
                        buttonFlag = 0;
                    }

                    if (pos.Y < 0) pos.Y = 0;
                    currentTile = SelectTile((int)pos.Y / 60, (int)pos.X / 60);
                }

                if ((currentButtonState.DPad.Down == ButtonState.Pressed || currentButtonState.ThumbSticks.Left.Y < 0 || currentKeyState.IsKeyDown(Keys.Down)))
                {
                    currentTile.TileDeselect();
                    pos.Y += 60;

                    if (buttonFlag == 0)
                    {
                        buttonFlag = 1;
                    }
                    if ((currentButtonState.DPad.Down == ButtonState.Pressed && oldButtonState.DPad.Down == ButtonState.Pressed) || (currentKeyState.IsKeyDown(Keys.Down) && oldKeyState.IsKeyDown(Keys.Down)))
                    {
                        pos.Y -= 60;
                    }
                    else
                    {
                        buttonFlag = 0;
                    }

                    if ((int)pos.Y / 60 > map.getHeight() - 1) pos.Y -= 60;
                    currentTile = SelectTile((int)pos.Y / 60, (int)pos.X / 60);
                }

                if ((currentButtonState.Buttons.A == ButtonState.Pressed || currentKeyState.IsKeyDown(Keys.Space)))
                {
                    if (buttonFlag == 0)
                    {
                        buttonFlag = 1;
                    }
                    if ((currentButtonState.Buttons.A == ButtonState.Pressed && oldButtonState.Buttons.A == ButtonState.Pressed) || (currentKeyState.IsKeyDown(Keys.Space) && oldKeyState.IsKeyDown(Keys.Space)))
                    {
                        //Do Nothing
                        buttonFlag = 0;
                    }
                    else
                    {
                        selectedCharacter = map.GetSquare((int)pos.Y / 60, (int)pos.X / 60).getCurrentChar();
                        if (selectedCharacter == null && moveFlag == 0 && attackFlag == 0)
                        {
                            screenManager.AddScreen(new PopupScreen(game, null), null);
                            buttonFlag = 1;
                        }
                        if (selectedCharacter != null && moveFlag == 0 && attackFlag == 0 && selectedCharacter.PlayerIndex == playerManager.GetCurrentPlayer())
                        {
                            screenManager.AddScreen(new PopupScreen(game, selectedCharacter), null);
                            buttonFlag = 1;
                        }

                        if (moveFlag == 1 && buttonFlag == 1 && map.GetSquare((int)pos.Y / 60, (int)pos.X / 60).getCurrentChar() == null )
                        {
                            if(map.GetSquare((int)pos.X / 60, (int)pos.Y / 60).IsMovable)
                            {
                                movingCharacter.Move((int)pos.X / 60, (int)pos.Y / 60);
                                ClearBoard();
                            }
                        }

                        if (attackFlag == 1 && buttonFlag == 1 && map.GetSquare((int)pos.Y / 60, (int)pos.X / 60).getCurrentChar() != null)
                        {
                            if (map.GetSquare((int)pos.X / 60, (int)pos.Y / 60).IsAttackable)
                            {
                                attackedCharacter = map.GetSquare((int)pos.Y / 60, (int)pos.X / 60).getCurrentChar();
                                attackedCharacter.Attacked = 1;
                                attackingCharacter.Attacking = 1;
                                attackingCharacter.Attack((int)pos.Y / 60, (int)pos.X / 60);

                                screenManager.AddScreen(new BattleScreen(game, attackingCharacter, attackedCharacter), null);
                                gameStateManager.State = GameState.combat;

                                ClearBoard();
                            }
                        }
                    }
                }

                if ((currentButtonState.Buttons.B == ButtonState.Pressed || currentKeyState.IsKeyDown(Keys.B)))
                {
                    if (buttonFlag == 0)
                    {
                        buttonFlag = 1;
                    }
                    if ((currentButtonState.Buttons.A == ButtonState.Pressed && oldButtonState.Buttons.A == ButtonState.Pressed) || (currentKeyState.IsKeyDown(Keys.Space) && oldKeyState.IsKeyDown(Keys.Space)))
                    {
                        //Do Nothing
                        buttonFlag = 0;
                    }
                    if (moveFlag == 1 && buttonFlag == 1)
                    {
                        movingCharacter.HasMoved = false;
                        movingCharacter = null;
                        selectedCharacter = null;
                        moveFlag = 0;
                        buttonFlag = 0;

                         for (int i = 0; i < map.getHeight(); i++)
                         {
                            for (int j = 0; j < map.getWidth(); j++)
                            {
                                    map.GetSquare(i, j).IsMovable = false;
                            }
                         }
                    }
                    if (attackFlag == 1 && buttonFlag == 1)
                    {
                        attackingCharacter.HasAttacked = false;
                        attackingCharacter = null;
                        attackFlag = 0;
                        buttonFlag = 0;

                        for (int i = 0; i < map.getHeight(); i++)
                        {
                            for (int j = 0; j < map.getWidth(); j++)
                            {
                                map.GetSquare(i, j).IsAttackable = false;
                            }
                        }
                    }
                }

                oldButtonState = currentButtonState;
                oldKeyState = currentKeyState;
            }
            base.Update(gameTime);
        }