/// <summary> /// Draws a dragon on the graphics. /// By default, dragons will be represented by a centered red rectangle that takes up half of the cells size. /// </summary> /// <param name="g">the graphics-object to draw on</param> /// <param name="dragon">the dragon to draw</param> protected void drawDragon(Graphics g, IPositionable dragon) { Size tileSize = this.getTileSize(); g.FillRectangle(new SolidBrush(Color.DarkRed), dragon.getXPosition() * tileSize.Width + tileSize.Width / 2 - tileSize.Width / 4, dragon.getYPosition() * tileSize.Height + tileSize.Height / 2 - tileSize.Height / 4, tileSize.Width / 2, tileSize.Height / 2); }
/// <summary> /// Draws a player on the graphics. /// By default, players will be represented by a centered dark-yellow rectangle that takes up half of the cells size. /// </summary> /// <param name="g">the graphics-object to draw on</param> /// <param name="player">the player to draw</param> protected void drawPlayer(Graphics g, IPositionable player) { int[] tmp = ba.getMyPos(); if (tmp[0] == player.getXPosition() && tmp[1] == player.getYPosition()) { Size tileSize = this.getTileSize(); g.FillRectangle(new SolidBrush(Color.DarkGoldenrod), player.getXPosition() * tileSize.Width + tileSize.Width / 2 - tileSize.Width / 4, player.getYPosition() * tileSize.Height + tileSize.Height / 2 - tileSize.Height / 4, tileSize.Width / 2, tileSize.Height / 2); } else { Size tileSize = this.getTileSize(); g.FillRectangle(new SolidBrush(Color.DarkCyan), player.getXPosition() * tileSize.Width + tileSize.Width / 2 - tileSize.Width / 4, player.getYPosition() * tileSize.Height + tileSize.Height / 2 - tileSize.Height / 4, tileSize.Width / 2, tileSize.Height / 2); } }