diff --git a/src/Blaze-Brigade/Blaze_Brigade/Game.cs b/src/Blaze-Brigade/Blaze_Brigade/Game.cs index 46d4564bb3c31936a1a2a7e77150fe1fb684ba9b..90684558c13ba2e8928ae0c18d8f99b35980819d 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/Game.cs +++ b/src/Blaze-Brigade/Blaze_Brigade/Game.cs @@ -49,7 +49,7 @@ namespace Controller GraphicsDeviceManager graphics; SpriteBatch spriteBatch; - Texture2D backGround; + Texture2D backGround, moveableNode, attackableNode; private SpriteFont font; //custom font // constructor for game @@ -86,8 +86,12 @@ namespace Controller initializeGame(); backGround = Content.Load<Texture2D>("Game_Map"); // load background + moveableNode = Content.Load<Texture2D>("moveableNode"); + attackableNode = Content.Load<Texture2D>("attackableNode"); + font = Content.Load<SpriteFont>("PixelFont"); //loads font PixelFont + graphics.PreferredBackBufferWidth = gameFunction.SCREEN_WIDTH; // width of screen graphics.PreferredBackBufferHeight = gameFunction.SCREEN_HEIGHT; //height of screen @@ -213,16 +217,37 @@ namespace Controller Unit unit = player1.getUnits().ElementAt(i); //gets unit at i spriteBatch.Draw(unit.getSpriteImage(), unit.getPixelCoordinates(), Color.White);//draws sprite - + + //if unit is currently clicked on, draw char info screen if (unit.getClickedOn()) { + //Highlight movable nodes in blue + LinkedList<Node> moveableNodes = gameFunction.getMovableNodes(graph, unit); + foreach(Node move in moveableNodes) + { + spriteBatch.Draw(moveableNode, move.getPosition(), Color.White * 0.3f); + } + + //Highlight attackable nodes in red + LinkedList<Node> attackableNodes = gameFunction.getAttackableNodes(graph, unit); + foreach (Node attack in attackableNodes) + { + if (!moveableNodes.Contains(attack)) + { + spriteBatch.Draw(attackableNode, attack.getPosition(), Color.White * 0.2f); + } + } + + + if (unit.getMenuOpen()) //if dropDowMenu should be opened, draw dropDownMenu { Vector2 menuIncrement = new Vector2(0, 32); //increment downwards for successive button - Vector2 currentButtonPosition = Vector2.Add(unit.getPixelCoordinates(), menuIncrement); //starting location for button + Vector2 initialOffset = new Vector2(32, 0); + Vector2 currentButtonPosition = Vector2.Add(unit.getPixelCoordinates(), initialOffset); //starting location for button for (int j = 0; j < 4; j++) { spriteBatch.Draw(unit.getButtonImage(j), currentButtonPosition, Color.White); //draws each button @@ -256,10 +281,17 @@ namespace Controller spriteBatch.Draw(unit.getSpriteImage(), unit.getPixelCoordinates(), Color.White); } + + + + //spriteBatch.Draw(backGround, Vector2.Zero, Color.White); // draws background + break; + + } - //spriteBatch.Draw(backGround, Vector2.Zero, Color.White); // draws background + spriteBatch.End(); // end spriteBatch base.Draw(gameTime); // repeatedly calls draw } diff --git a/src/Blaze-Brigade/Blaze_Brigade/MouseHandler.cs b/src/Blaze-Brigade/Blaze_Brigade/MouseHandler.cs index 5089d3fd5c05662b60579f957bda610e80e7c572..52dc8b4c5792c37a8344f4d30889827d4c61251a 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/MouseHandler.cs +++ b/src/Blaze-Brigade/Blaze_Brigade/MouseHandler.cs @@ -109,6 +109,7 @@ namespace Controller isAnimating = animating; } + //which dropdownmenu is selected void buttonAction(int i) { //take action corresponding to which button was clicked diff --git a/src/Blaze-Brigade/Blaze_Brigade/Node.cs b/src/Blaze-Brigade/Blaze_Brigade/Node.cs index 7a1dbb8ebe3b1513984d0d8dd8e9231665a80dc5..7cb9591c8e1b9ab87eebab8fbb2405e4270c744d 100644 --- a/src/Blaze-Brigade/Blaze_Brigade/Node.cs +++ b/src/Blaze-Brigade/Blaze_Brigade/Node.cs @@ -1,4 +1,5 @@ -using System; +using Microsoft.Xna.Framework; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -9,6 +10,8 @@ namespace Model { private int movabilityObstruction; // index for hindrance of the movability of a unit; 0 = no hindrance private bool isObstacle; // indicates whether a unit can stand inside the tile + private bool highlightMove; + private bool highlightAttack; private int positionX; // position x on the grid private int positionY; // position y on the grid @@ -43,6 +46,12 @@ namespace Model return isObstacle; } + public Vector2 getPosition() + { + Vector2 position = new Vector2(getPositionX()*32, getPositionY()*32); + return position; + } + public int getPositionX() { return positionX; @@ -74,5 +83,6 @@ namespace Model return false; } } + } }