Example #1
0
 /// <summary>
 /// Constructs a search token object
 /// </summary>
 /// <param name="content">The content manager</param>
 /// <param name="incTile">The tile to draw on</param>
 /// <param name="xLoc">X loc of the search token</param>
 /// <param name="yLoc">Y loc of the search token</param>
 public Token(Rectangle sourceRectangle, Tile incTile, int xLoc, int yLoc, int tokenIndex)
 {
     this.sourceRectangle = sourceRectangle; variable = tokenIndex;
     int tempX = incTile.X + xLoc, tempY = incTile.Y + yLoc;
     drawRectangle = new Rectangle(tempX, tempY, GameConstants.GRID_SIZE, GameConstants.GRID_SIZE);
 }
Example #2
0
 /// <summary>
 /// Constructs a hero token for the selected hero
 /// </summary>
 /// <param name="contentManager">The content manager for loading content</param>
 /// <param name="sprite">The image of the selected token</param>
 /// <param name="name">Name of the selected hero</param>
 /// <param name="number">Number of the token being generated for initial board placement</param>
 public Token(string name, int number, Tile incTile, int hp, int sta, int move, Rectangle sourceRectangle)
 {
     int tempX, tempY; // used to place the hero token on the board
     switch (number)
     {
         case 1: tempX = incTile.X; tempY = incTile.Y - 64; break;
         case 2: tempX = incTile.X + 64; tempY = incTile.Y - 64; break;
         case 3: tempX = incTile.X + 128; tempY = incTile.Y - 64; break;
         case 4: tempX = incTile.X + 192; tempY = incTile.Y - 64; break;
         default: tempX = HalfWindowWidth(); tempY = HalfWindowHeight(); break;
     }
     drawRectangle = new Rectangle(tempX, tempY, sourceRectangle.Width, sourceRectangle.Height);
     this.sourceRectangle = sourceRectangle;
     location.X = tempX + 32; location.Y = tempY + 32;
     originalPosition = location;
     originalDrawRect = drawRectangle;
     halfDrawRectangleHeight = sourceRectangle.Height / 2;
     halfDrawRectangleWidth = sourceRectangle.Width / 2;
     this.name = name; variable = number; hitPoints = hp; stamina = sta; movement = move;
 }
Example #3
0
        /// <summary>
        /// Constructs a monster token
        /// </summary>
        /// <param name="content">The content manager</param>
        /// <param name="sprite">A string containing the sprites location</param>
        /// <param name="isMaster">If the monster is a master</param>
        /// <param name="monsterType">number indicating which monster it is: 0 = zombie, 1 = dragon, 2 = flesh moulder, 3 = barghest</param>
        /// <param name="incTile"></param>
        public Token(string name, Rectangle sourceRectangle, bool isMaster, int monsterType, Tile incTile, int xLocation, int yLocation, int width, int height, int hp, int sta, int move)
        {
            int tokenX = incTile.X + xLocation, tokenY = incTile.Y + yLocation;

            this.monsterType = monsterType; this.isMaster = isMaster; this.name = name;
            drawRectangle = new Rectangle(tokenX, tokenY, width, height);

            if (width == 64) location.X = tokenX + 32;
            else if (width == 128) location.X = tokenX + 64;
            else location.X = tokenX + 96;
            if (height == 64) location.Y = tokenY + 32;
            else location.Y = tokenY + 64;
            this.sourceRectangle = sourceRectangle;
            halfDrawRectangleWidth = sourceRectangle.Width / 2; halfDrawRectangleHeight = sourceRectangle.Height / 2;
            hitPoints = hp; stamina = sta; movement = move;
        }