/// <summary> /// Creates the stats screen on the right hand side with the characters current stats /// There's probably a much better way to do this. /// </summary> /// <param name="rightBorderX"></param> /// <param name="topMargin"></param> /// <param name="length"></param> /// <param name="height"></param> /// <param name="borderClr"></param> /// <param name="BGColor"></param> /// <param name="hero"></param> public void SetStatScreen(int rightBorderX, int topMargin, int length, int height, ConsoleColor borderClr, ConsoleColor BGColor, Attributes hero) { DrawRectangle(length, height, (rightBorderX + 5), (topMargin), borderClr, BGColor); Console.BackgroundColor = BGColor; Console.ForegroundColor = ConsoleColor.White; Console.SetCursorPosition((rightBorderX + 8), (topMargin + 4)); Console.Write("Hero Name: " + hero.Name); Console.WriteLine(); UpdateHP(); Console.WriteLine(); Console.CursorLeft = (rightBorderX + 8); Console.ForegroundColor = ConsoleColor.Yellow; Console.Write("Weapon: " + hero.Weapon); Console.WriteLine(); Console.CursorLeft = (rightBorderX + 8); Console.WriteLine(); Console.CursorLeft = (rightBorderX + 8); UpdatePoints(); }
/// <summary> /// Check to see if the new coodrdinates the player is moving in /// collide with a wall. If so, the player doesn't move beyond the wall. /// If not, the player moves 1 space in that direction. /// Right now the monster is not used, but I will keep it there for now /// in case in the future we need it. /// </summary> /// <param name="d"></param> /// <param name="walls"></param> public void move(ConsoleKey d, IList <IList <Obstacles> > walls, int x, int y, IList <Attributes> monster, IList <Item> item, Attributes Hero, ConsoleColor BGColor, IList <IList <Item> > sword, IList <Item> singleShots) { Console.SetCursorPosition(Hero.X, Hero.Y); Console.ForegroundColor = ConsoleColor.Black; Console.Write(" "); // if (d == Keys.Direction.Down) if (d == ConsoleKey.DownArrow) { Hero.Y += 1; Hero.Symbol = "v"; //If hero is warrior if (Game.character.Color.Equals(ConsoleColor.Blue)) { foreach (IList <Item> el in sword) { foreach (Item sw in el) { sw.Y += 1; } } } //If hero is mage or hunter if (Game.character.Color.Equals(ConsoleColor.Green) || Game.character.Color.Equals(ConsoleColor.Red)) { foreach (Item el in singleShots) { el.Y += 1; } } // Checks collision for down if (collision.checkHeroWall(Hero, walls, x, y) || collision.CheckHeroMon(monster, Hero)) { Hero.Y -= 1; //If hero is warrior if (Game.character.Color.Equals(ConsoleColor.Blue)) { foreach (IList <Item> el in sword) { foreach (Item sw in el) { sw.Y -= 1; } } } //If hero is mage or hunter if (Game.character.Color.Equals(ConsoleColor.Green) || Game.character.Color.Equals(ConsoleColor.Red)) { foreach (Item el in singleShots) { el.Y -= 1; } } } } // if (d == Keys.Direction.Up) if (d == ConsoleKey.UpArrow) { Hero.Y -= 1; Hero.Symbol = "^"; // If hero is warrior if (Game.character.Color.Equals(ConsoleColor.Blue)) { foreach (IList <Item> el in sword) { foreach (Item sw in el) { sw.Y -= 1; } } } // If hero is mage or hunter if (Game.character.Color.Equals(ConsoleColor.Green) || Game.character.Color.Equals(ConsoleColor.Red)) { foreach (Item el in singleShots) { el.Y -= 1; } } // Checks Collision if (collision.checkHeroWall(Hero, walls, x, y) || collision.CheckHeroMon(monster, Hero)) { Hero.Y += 1; // if hero is warrior if (Game.character.Color.Equals(ConsoleColor.Blue)) { foreach (IList <Item> el in sword) { foreach (Item sw in el) { sw.Y += 1; } } } //if hero is mage or hunter if (Game.character.Color.Equals(ConsoleColor.Green) || Game.character.Color.Equals(ConsoleColor.Red)) { foreach (Item el in singleShots) { el.Y += 1; } } } } //if (d == Keys.Direction.Left) if (d == ConsoleKey.LeftArrow) { Hero.X -= 1; Hero.Symbol = "<"; // if hero is warrior if (Game.character.Color.Equals(ConsoleColor.Blue)) { foreach (IList <Item> el in sword) { foreach (Item sw in el) { sw.X -= 1; } } } // if hero is mage or hunter if (Game.character.Color.Equals(ConsoleColor.Green) || Game.character.Color.Equals(ConsoleColor.Red)) { foreach (Item el in singleShots) { el.X -= 1; } } if (collision.checkHeroWall(Hero, walls, x, y) || collision.CheckHeroMon(monster, Hero)) { Hero.X += 1; // if hero is warrior if (Game.character.Color.Equals(ConsoleColor.Blue)) { foreach (IList <Item> el in sword) { foreach (Item sw in el) { sw.X += 1; } } } // if hero is mage or hunter if (Game.character.Color.Equals(ConsoleColor.Green) || Game.character.Color.Equals(ConsoleColor.Red)) { foreach (Item el in singleShots) { el.X += 1; } } } } //if (d == Keys.Direction.Right) if (d == ConsoleKey.RightArrow) { Hero.X += 1; Hero.Symbol = ">"; // if hero is warrior if (Game.character.Color.Equals(ConsoleColor.Blue)) { foreach (IList <Item> el in sword) { foreach (Item sw in el) { sw.X += 1; } } } // if hero is mage or hunter if (Game.character.Color.Equals(ConsoleColor.Green) || Game.character.Color.Equals(ConsoleColor.Red)) { foreach (Item el in singleShots) { el.X += 1; } } if (collision.checkHeroWall(Hero, walls, x, y) || collision.CheckHeroMon(monster, Hero)) { Hero.X -= 1; //if hero is warrior if (Game.character.Color.Equals(ConsoleColor.Blue)) { foreach (IList <Item> el in sword) { foreach (Item sw in el) { sw.X -= 1; } } } // if hero is mage or hunter if (Game.character.Color.Equals(ConsoleColor.Green) || Game.character.Color.Equals(ConsoleColor.Red)) { foreach (Item el in singleShots) { el.X -= 1; } } } } if (collision.checkHeroItem(Hero, item)) { Game game = new Game(); game.PlaySounds("Coin.wav", 75); Game.points += 2; Display.UpdatePoints(); } DrawHero(Hero, BGColor); }