Пример #1
0
 private void DrawDoor(Tuple <EngineFunctions.COORD, EngineFunctions.COORD> t)
 {
     if (t.Item1.X < t.Item2.X) //door to the right
     {
         for (int y = (Console.WindowHeight - 10) / 2 - 2; y <= (Console.WindowHeight - 10) / 2 + 2; y++)
         {
             EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(Console.WindowWidth - 1), (short)y), 'X', ConsoleColor.DarkYellow);
         }
     }
     else if (t.Item1.X > t.Item2.X) //door to the left
     {
         for (int y = (Console.WindowHeight - 10) / 2 - 2; y <= (Console.WindowHeight - 10) / 2 + 2; y++)
         {
             EngineFunctions.DrawToConsole(new EngineFunctions.COORD(0, (short)y), 'X', ConsoleColor.DarkYellow);
         }
     }
     else if (t.Item1.Y < t.Item2.Y) // door to the bottom
     {
         for (int x = Console.WindowWidth / 2 - 2; x <= Console.WindowWidth / 2 + 2; x++)
         {
             EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)x, (short)(Console.WindowHeight - 10)), 'X', ConsoleColor.DarkYellow);
         }
     }
     else if (t.Item1.Y > t.Item2.Y) // door to the top
     {
         for (int x = Console.WindowWidth / 2 - 2; x <= Console.WindowWidth / 2 + 2; x++)
         {
             EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)x, 0), 'X', ConsoleColor.DarkYellow);
         }
     }
 }
Пример #2
0
        public void DrawMenu()
        {
            EngineFunctions.DrawToConsole(new EngineFunctions.COORD(10, 5), line1, ConsoleColor.White);
            EngineFunctions.DrawToConsole(new EngineFunctions.COORD(10, 6), line2, ConsoleColor.White);
            EngineFunctions.DrawToConsole(new EngineFunctions.COORD(10, 7), line3, ConsoleColor.White);
            EngineFunctions.DrawToConsole(new EngineFunctions.COORD(10, 8), line4, ConsoleColor.White);

            EngineFunctions.DrawToConsole(new EngineFunctions.COORD(20, 12), line5, ConsoleColor.White);
            EngineFunctions.DrawToConsole(new EngineFunctions.COORD(20, 13), line6, ConsoleColor.White);
            EngineFunctions.DrawToConsole(new EngineFunctions.COORD(20, 14), line7, ConsoleColor.White);
            EngineFunctions.DrawToConsole(new EngineFunctions.COORD(20, 15), line8, ConsoleColor.White);

            for (int x = 0; x < Console.WindowWidth; x++)
            {
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)x, 17), '-', ConsoleColor.White);
            }

            if (!showSaves)
            {
                foreach (MenuItem mi in defaultItems)
                {
                    EngineFunctions.DrawToConsole(mi.position, mi.text, ConsoleColor.White);
                }
                SetSelection(defaultItems);
            }
            else
            {
                foreach (MenuItem mi in saveItems)
                {
                    EngineFunctions.DrawToConsole(mi.position, mi.text, ConsoleColor.White);
                }
                SetSelection(saveItems);
            }
        }
Пример #3
0
        public void DrawItem()
        {
            switch (IType)
            {
            case ItemType.Bomb:
                EngineFunctions.DrawToConsole(Location, 'B', ConsoleColor.DarkBlue);
                break;

            case ItemType.Heart:
                EngineFunctions.DrawToConsole(Location, 'H', ConsoleColor.Magenta);
                break;

            case ItemType.Key:
                EngineFunctions.DrawToConsole(Location, 'K', ConsoleColor.White);
                break;

            case ItemType.Magic:
                EngineFunctions.DrawToConsole(Location, 'M', ConsoleColor.DarkCyan);
                break;

            case ItemType.Crystal:
                EngineFunctions.DrawToConsole(Location, (char)0xA4, ConsoleColor.Yellow);
                break;

            case ItemType.Sphere:
                EngineFunctions.DrawToConsole(Location, '0', Map.CurLevelInfo.Key);
                break;
            }
        }
Пример #4
0
        public void DrawEnemy()
        {
            switch (enemytype)
            {
            default:
            case EType.Grunt:
                EngineFunctions.DrawToConsole(loc, 'E', ConsoleColor.DarkRed);
                break;

            case EType.Beast:
                EngineFunctions.DrawToConsole(loc, 'B', ConsoleColor.DarkMagenta);
                break;

            case EType.Fighter:
                EngineFunctions.DrawToConsole(loc, 'F', ConsoleColor.Blue);
                break;

            case EType.Warrior:
                EngineFunctions.DrawToConsole(loc, 'W', ConsoleColor.Red);
                break;

            case EType.Glider:
                EngineFunctions.DrawToConsole(loc, 'G', ConsoleColor.DarkCyan);
                break;

            case EType.Dragon:
                EngineFunctions.DrawToConsole(loc, 'D', Map.CurLevelInfo.Key);
                break;
            }
        }
Пример #5
0
        public void UpdateParticles()
        {
            foreach (Particle p in particles)
            {
                if (!p.timer.IsRunning)
                {
                    p.timer.Start();
                }
                if (p.timer.ElapsedMilliseconds >= 250)
                {
                    p.Pos    = new EngineFunctions.COORD(p.Pos.X, (short)(p.Pos.Y - p.Speed));
                    p.Moved += p.Speed;
                    if (p.Pos.Y < 0 || p.Moved > p.Life)
                    {
                        p.KillFlag = true;
                    }
                    p.timer.Restart();
                }
                if (p.Pos.Y < 20 && p.Pos.Y >= 0)
                {
                    EngineFunctions.DrawToConsole(p.Pos, p.PartChar, p.Color, Map.CurLevelInfo.Key);
                }
            }

            particles.RemoveAll(x => x.KillFlag == true);
        }
Пример #6
0
 public void DrawDivider()
 {
     for (int x = 0; x < Console.WindowWidth; x++)
     {
         EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(x), (short)(21)), '-', ConsoleColor.DarkGray);
     }
 }
Пример #7
0
        public void DrawSpheres()
        {
            short xStart = (short)(Console.WindowWidth / 1.25);
            short yStart = (short)(Console.WindowHeight - 3);

            for (short x = 0; x < Spheres.Count; x++)
            {
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(xStart + x), yStart), (char)0xA4, Spheres[x]);
            }
        }
Пример #8
0
        public void DrawItemsToBuy()
        {
            short x = 30;

            for (int index = 0; index < 3; index++)
            {
                prices[index] = GetPrice(itemsForSale[index]);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(x + index * 10), 9), prices[index].ToString(), ConsoleColor.Yellow);
                EngineFunctions.screenBufferArray[11, x + index * 10 + 1] = GetChar(itemsForSale[index]);
            }
        }
Пример #9
0
        public void DrawItemAmounts()
        {
            short xStart = (short)(Console.WindowWidth / 1.25);
            short yStart = (short)(Console.WindowHeight - 7);

            EngineFunctions.DrawToConsole(new EngineFunctions.COORD(xStart, yStart), "Keys: " + Keys, ConsoleColor.White);
            EngineFunctions.DrawToConsole(new EngineFunctions.COORD(xStart, (short)(yStart + 1)), "Bombs: " + Bombs, ConsoleColor.DarkBlue);
            EngineFunctions.DrawToConsole(new EngineFunctions.COORD(xStart, (short)(yStart + 2)), "Magic: " + MagicAmt, ConsoleColor.DarkCyan);
            EngineFunctions.DrawToConsole(new EngineFunctions.COORD(xStart, (short)(yStart + 3)), (char)(0xA7), ConsoleColor.Yellow);
            EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(xStart + 1), (short)(yStart + 3)), ": " + Money, ConsoleColor.Yellow);
        }
Пример #10
0
        public void DrawItem(ItemType it)
        {
            short start = (short)(Console.WindowWidth / 3 + 15);

            for (short x = start; x < (start + 11); x++)
            {
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD(x, (short)(Console.WindowHeight - 2)), '-', ConsoleColor.White);
                if (x == start + 4 || x == start + 6)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(x, (short)(Console.WindowHeight - 8)), ' ', ConsoleColor.White);
                }
                else if (x == start + 5)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(x, (short)(Console.WindowHeight - 8)), 'e', ConsoleColor.White);
                }
                else
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(x, (short)(Console.WindowHeight - 8)), '-', ConsoleColor.White);
                }
            }
            for (short y = (short)(Console.WindowHeight - 8); y <= Console.WindowHeight - 2; y++)
            {
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(start - 1), y), '|', ConsoleColor.White);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(start + 11), y), '|', ConsoleColor.White);
            }

            switch (it)
            {
            case ItemType.Bomb:
            default:
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(start + 6), (short)(Console.WindowHeight - 7)), '*', ConsoleColor.DarkBlue);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(start + 5), (short)(Console.WindowHeight - 6)), '/', ConsoleColor.Gray);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(start + 4), (short)(Console.WindowHeight - 6)), '_', ConsoleColor.Blue);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(start + 3), (short)(Console.WindowHeight - 5)), '/', ConsoleColor.Blue);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(start + 5), (short)(Console.WindowHeight - 5)), '\\', ConsoleColor.Blue);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(start + 3), (short)(Console.WindowHeight - 4)), '\\', ConsoleColor.Blue);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(start + 4), (short)(Console.WindowHeight - 4)), '_', ConsoleColor.Blue);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(start + 5), (short)(Console.WindowHeight - 4)), '/', ConsoleColor.Blue);
                break;

            case ItemType.Magic:
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(start + 5), (short)(Console.WindowHeight - 7)), '_', ConsoleColor.DarkGray);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(start + 4), (short)(Console.WindowHeight - 6)), '/', ConsoleColor.DarkGray);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(start + 6), (short)(Console.WindowHeight - 6)), '\\', ConsoleColor.DarkGray);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(start + 4), (short)(Console.WindowHeight - 5)), '|', ConsoleColor.White);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(start + 5), (short)(Console.WindowHeight - 5)), '~', ConsoleColor.DarkCyan);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(start + 6), (short)(Console.WindowHeight - 5)), '|', ConsoleColor.White);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(start + 4), (short)(Console.WindowHeight - 4)), '\\', ConsoleColor.DarkGray);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(start + 5), (short)(Console.WindowHeight - 4)), '_', ConsoleColor.DarkGray);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(start + 6), (short)(Console.WindowHeight - 4)), '/', ConsoleColor.DarkGray);
                break;
            }
        }
Пример #11
0
        public Game()
        {
            Console.SetWindowSize(80, 30);
            EngineFunctions.AdjustColorPalette();

            startMenu = new Menu();

            musicThread = new Thread(new ThreadStart(PlayMusic));
            musicThread.IsBackground = true;
            //musicThread.Start();
            //while (!musicThread.IsAlive) ;
        }
Пример #12
0
 public void GetInput()
 {
     while (true)
     {
         EngineFunctions.Flush();
         if (DateTime.Now.TimeOfDay.Subtract(timeSinceUpdate) > TimeSpan.FromMilliseconds(50))
         {
             c = playerInput.GetInput();
             timeSinceUpdate = DateTime.Now.TimeOfDay;
         }
     }
 }
Пример #13
0
        public void DrawShop()
        {
            short yBottom = (short)(Console.WindowHeight - 10);
            short Wstop   = (short)(Console.WindowWidth - 3 * (Console.WindowWidth / 4));
            short Estop   = (short)(Console.WindowWidth - (Console.WindowWidth / 4));

            for (int i = Wstop; i < Console.WindowWidth / 2 - 2; i++)
            {
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(i), yBottom), '#', ConsoleColor.Gray);
            }
            for (int i = Console.WindowWidth / 2 + 2; i <= Estop; i++)
            {
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(i), yBottom), '#', ConsoleColor.Gray);
            }
            for (int i = Wstop; i <= Estop; i++)
            {
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(i), 0), '#', ConsoleColor.Gray);
            }
            for (int i = 0; i < Console.WindowHeight - 10; i++)
            {
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD(Wstop, (short)(i)), '#', ConsoleColor.Gray);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD(Estop, (short)(i)), '#', ConsoleColor.Gray);
            }

            if (CanBuy)
            {
                for (int x = Console.WindowWidth / 2 - 5; x < Console.WindowWidth / 2 + 5; x++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)x, 3), '_', ConsoleColor.DarkGray);
                }

                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(Console.WindowWidth / 2 - 6), 4), '/', ConsoleColor.DarkGray);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(Console.WindowWidth / 2 + 5), 4), '\\', ConsoleColor.DarkGray);

                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(Console.WindowWidth / 2 - 7), 5), '/', ConsoleColor.DarkGray);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(Console.WindowWidth / 2 + 6), 5), '\\', ConsoleColor.DarkGray);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(Console.WindowWidth / 2 - 3), 5), '*', ConsoleColor.DarkGray);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(Console.WindowWidth / 2 + 2), 5), '*', ConsoleColor.DarkGray);

                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(Console.WindowWidth / 2 - 8), 6), '/', ConsoleColor.DarkGray);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(Console.WindowWidth / 2 + 7), 6), '\\', ConsoleColor.DarkGray);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(Console.WindowWidth / 2 - 3), 6), '_', ConsoleColor.DarkGray);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(Console.WindowWidth / 2 - 2), 6), '_', ConsoleColor.DarkGray);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(Console.WindowWidth / 2 - 1), 6), '_', ConsoleColor.DarkGray);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(Console.WindowWidth / 2), 6), '_', ConsoleColor.DarkGray);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(Console.WindowWidth / 2 + 1), 6), '_', ConsoleColor.DarkGray);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(Console.WindowWidth / 2 + 2), 6), '_', ConsoleColor.DarkGray);

                DrawItemsToBuy();
            }
        }
Пример #14
0
 public bool CheckCollision()
 {
     if (curFacing == FaceDirection.Up)
     {
         if (EngineFunctions.GetCharacterAtPosition(new EngineFunctions.COORD(location.X, (short)(location.Y - 1))) == '#')
         {
             return(true);
         }
         else if (EngineFunctions.COLLISION_CHARS.Contains(EngineFunctions.screenBufferArray[location.Y - 1, location.X].AsciiChar))
         {
             return(true);
         }
     }
     else if (curFacing == FaceDirection.Down)
     {
         if (EngineFunctions.GetCharacterAtPosition(new EngineFunctions.COORD(location.X, (short)(location.Y + 1))) == '#')
         {
             return(true);
         }
         else if (EngineFunctions.COLLISION_CHARS.Contains(EngineFunctions.screenBufferArray[location.Y + 1, location.X].AsciiChar))
         {
             return(true);
         }
     }
     else if (curFacing == FaceDirection.Left)
     {
         if (EngineFunctions.GetCharacterAtPosition(new EngineFunctions.COORD((short)(location.X - 1), location.Y)) == '#')
         {
             return(true);
         }
         else if (EngineFunctions.COLLISION_CHARS.Contains(EngineFunctions.screenBufferArray[location.Y, location.X - 1].AsciiChar))
         {
             return(true);
         }
     }
     else if (curFacing == FaceDirection.Right)
     {
         if (EngineFunctions.GetCharacterAtPosition(new EngineFunctions.COORD((short)(location.X + 1), location.Y)) == '#')
         {
             return(true);
         }
         else if (EngineFunctions.COLLISION_CHARS.Contains(EngineFunctions.screenBufferArray[location.Y, location.X + 1].AsciiChar))
         {
             return(true);
         }
     }
     return(false);
 }
Пример #15
0
        public void DrawShopOnMap()
        {
            EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(location.X + 2), (short)(location.Y)), '_', ConsoleColor.DarkBlue);
            EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(location.X + 1), (short)(location.Y + 1)), '/', ConsoleColor.DarkBlue);
            EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(location.X + 3), (short)(location.Y + 1)), '\\', ConsoleColor.DarkBlue);

            EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(location.X), (short)(location.Y + 2)), '/', ConsoleColor.DarkBlue);
            EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(location.X + 2), (short)(location.Y + 2)), 'S', ConsoleColor.DarkBlue);
            EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(location.X + 4), (short)(location.Y + 2)), '\\', ConsoleColor.DarkBlue);

            EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(location.X), (short)(location.Y + 3)), '|', ConsoleColor.DarkBlue);
            EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(location.X + 1), (short)(location.Y + 3)), '_', ConsoleColor.DarkBlue);
            EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(location.X + 2), (short)(location.Y + 3)), (char)0x7F, ConsoleColor.DarkBlue);
            EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(location.X + 3), (short)(location.Y + 3)), '_', ConsoleColor.DarkBlue);
            EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(location.X + 4), (short)(location.Y + 3)), '|', ConsoleColor.DarkBlue);
        }
Пример #16
0
 private void DrawMapTransition()
 {
     if (setBg)
     {
         EngineFunctions.SetBackgroundColor(Map.CurLevelInfo.Key);
         setBg = false;
     }
     endLevelParticles.UpdateParticles();
     if (endLevelParticles.NoParticles)
     {
         setBg = true;
         m.ChangeMap();
         levelTransition = false;
         RoomsExplored   = 1;
         player.location = new EngineFunctions.COORD(1, 1);
     }
 }
Пример #17
0
        public void MoveEnemy()
        {
            if (DateTime.Now.TimeOfDay.Subtract(timeSinceUpdate) > TimeSpan.FromSeconds(1))
            {
                timeSinceUpdate = DateTime.Now.TimeOfDay;
                EngineFunctions.COORD curPlayerPos = Game.player.location;

                // modify x position
                if (loc.X < curPlayerPos.X && loc.X < Console.WindowWidth - 3)
                {
                    if (!CheckCollision(FaceDirection.Right))
                    {
                        EngineFunctions.DrawToConsole(loc, ' ');
                        loc = new EngineFunctions.COORD((short)(loc.X + 1), loc.Y);
                    }
                }
                else if (loc.X > curPlayerPos.X && loc.X > 2)
                {
                    if (!CheckCollision(FaceDirection.Left))
                    {
                        EngineFunctions.DrawToConsole(loc, ' ');
                        loc = new EngineFunctions.COORD((short)(loc.X - 1), loc.Y);
                    }
                }

                // modify y position
                if (loc.Y < curPlayerPos.Y && loc.Y < Console.WindowHeight - 13)
                {
                    if (!CheckCollision(FaceDirection.Down))
                    {
                        EngineFunctions.DrawToConsole(loc, ' ');
                        loc = new EngineFunctions.COORD(loc.X, (short)(loc.Y + 1));
                    }
                }
                else if (loc.Y > curPlayerPos.Y && loc.Y > 2)
                {
                    if (!CheckCollision(FaceDirection.Up))
                    {
                        EngineFunctions.DrawToConsole(loc, ' ');
                        loc = new EngineFunctions.COORD(loc.X, (short)(loc.Y - 1));
                    }
                }
            }
            DrawEnemy();
        }
Пример #18
0
        public void DrawHealth(int hp)
        {
            short yStep = (short)(Console.WindowHeight - 7);
            short xStep = 3;

            for (int x = 0; x < hp; x++)
            {
                if (x > hp)
                {
                    break;
                }
                if (x % 16 == 0)
                {
                    xStep = 3;
                    yStep++;
                }
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD(xStep, yStep), '|', ConsoleColor.Red);
                xStep++;
            }
        }
Пример #19
0
        public void PlaceCharacter()
        {
            switch (curFacing)
            {
            case FaceDirection.Up:
            default:
                EngineFunctions.DrawToConsole(location, '^', ConsoleColor.Green);
                break;

            case FaceDirection.Down:
                EngineFunctions.DrawToConsole(location, 'V', ConsoleColor.Green);
                break;

            case FaceDirection.Left:
                EngineFunctions.DrawToConsole(location, '<', ConsoleColor.Green);
                break;

            case FaceDirection.Right:
                EngineFunctions.DrawToConsole(location, '>', ConsoleColor.Green);
                break;
            }
        }
Пример #20
0
        public void PlaceCharacterNewScreen()
        {
            Console.SetCursorPosition(location.X, location.Y);
            switch (curFacing)
            {
            case FaceDirection.Up:
            default:
                EngineFunctions.DrawToConsole(location, '^', ConsoleColor.Green);
                break;

            case FaceDirection.Down:
                EngineFunctions.DrawToConsole(location, 'V', ConsoleColor.Green);
                break;

            case FaceDirection.Left:
                EngineFunctions.DrawToConsole(location, '<', ConsoleColor.Green);
                break;

            case FaceDirection.Right:
                EngineFunctions.DrawToConsole(location, '>', ConsoleColor.Green);
                break;
            }
        }
Пример #21
0
        private void DrawGameOver()
        {
            string gameLine1 = @" /¯¯¯¯/|¯¯¯¯|   /¯¯¯¯/-\¯¯¯¯\   \¯¯¯¯\     /¯¯¯¯/  /¯¯¯¯/\¯¯¯¯\ ";
            string gameLine2 = @" |.: | |____|   |..::|_|::. |   |  .:||¯¯¯||.:: |  \____\_¯¯¯¯  ";
            string gameLine3 = @" |:::| \¯¯¯¯\   |.:::|¯|:::.|   |.:::|'\_/'|:::.|  /¯¯¯¯/¯____";
            string gameLine4 = @" \____\/____/   |____| |____|  /____/|\_'_/|\____\ \____\/____/ ";

            string overLine1 = @"  /¯¯¯/¯\¯¯¯\   |¯¯¯¯| |¯¯¯¯|  /¯¯¯¯/\¯¯¯¯\ |¯¯¯¯|\¯¯¯¯\  ";
            string overLine2 = @" |::..| |..::|  |.::.| |.::.|  \____\_¯¯¯¯  |.:::|/____/ ";
            string overLine3 = @" |.:::| |::: |  |::. | |.:::|  /¯¯¯¯/¯____  |::: |\¯¯¯¯\";
            string overLine4 = @"  \___\_/___/    \___\_/___/   \____\/____/ |____| |____| ";

            EngineFunctions.DrawToConsole(new EngineFunctions.COORD(9, 6), gameLine1, ConsoleColor.Red);
            EngineFunctions.DrawToConsole(new EngineFunctions.COORD(9, 7), gameLine2, ConsoleColor.Red);
            EngineFunctions.DrawToConsole(new EngineFunctions.COORD(9, 8), gameLine3, ConsoleColor.Red);
            EngineFunctions.DrawToConsole(new EngineFunctions.COORD(9, 9), gameLine4, ConsoleColor.Red);

            EngineFunctions.DrawToConsole(new EngineFunctions.COORD(12, 11), overLine1, ConsoleColor.Red);
            EngineFunctions.DrawToConsole(new EngineFunctions.COORD(12, 12), overLine2, ConsoleColor.Red);
            EngineFunctions.DrawToConsole(new EngineFunctions.COORD(12, 13), overLine3, ConsoleColor.Red);
            EngineFunctions.DrawToConsole(new EngineFunctions.COORD(12, 14), overLine4, ConsoleColor.Red);

            EngineFunctions.DrawToConsole(new EngineFunctions.COORD(35, 20), "PRESS SPACE...", ConsoleColor.White);
        }
Пример #22
0
        public void DrawSword(SwordType st)
        {
            short start = (short)(Console.WindowWidth / 3);

            for (short x = start; x < (start + 11); x++)
            {
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD(x, (short)(Console.WindowHeight - 2)), '-', ConsoleColor.White);
                if (x == start + 2 || x == start + 8)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(x, (short)(Console.WindowHeight - 8)), ' ', ConsoleColor.White);
                }
                else if (x == start + 3)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(x, (short)(Console.WindowHeight - 8)), "Space", ConsoleColor.White);
                }
                else if (x >= start + 4 && x <= start + 7)
                {
                    continue;
                }
                else
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(x, (short)(Console.WindowHeight - 8)), '-', ConsoleColor.White);
                }
            }
            for (short y = (short)(Console.WindowHeight - 8); y <= Console.WindowHeight - 2; y++)
            {
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(start - 1), y), '|', ConsoleColor.White);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(start + 11), y), '|', ConsoleColor.White);
            }

            switch (st)
            {
            case SwordType.Wood:
            default:
                for (short y = 0; y < 4; y++)
                {
                    if (y == 2)
                    {
                        for (short x = 0; x < 3; x++)
                        {
                            EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(start + 4 + x), (short)(Console.WindowHeight - 6 + y)), '=', ConsoleColor.DarkYellow);
                        }
                    }
                    else
                    {
                        EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(start + 5), (short)(Console.WindowHeight - 6 + y)), '|', ConsoleColor.DarkYellow);
                    }
                }
                break;

            case SwordType.Short:
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(start + 7), (short)(Console.WindowHeight - 6)), '/', ConsoleColor.Gray);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(start + 6), (short)(Console.WindowHeight - 5)), '/', ConsoleColor.Gray);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(start + 4), (short)(Console.WindowHeight - 3)), '/', ConsoleColor.Gray);
                for (short x = 0; x < 3; x++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(start + 4 + x), (short)(Console.WindowHeight - 4)), '=', ConsoleColor.Gray);
                }
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(start + 3), (short)(Console.WindowHeight - 4)), '<', ConsoleColor.Gray);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(start + 7), (short)(Console.WindowHeight - 4)), '>', ConsoleColor.Gray);
                break;

            case SwordType.Great:
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(start + 6), (short)(Console.WindowHeight - 7)), '/', ConsoleColor.Cyan);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(start + 7), (short)(Console.WindowHeight - 7)), '\\', ConsoleColor.Cyan);

                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(start + 5), (short)(Console.WindowHeight - 6)), '/', ConsoleColor.Cyan);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(start + 7), (short)(Console.WindowHeight - 6)), '/', ConsoleColor.Cyan);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(start + 4), (short)(Console.WindowHeight - 5)), '/', ConsoleColor.Cyan);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(start + 6), (short)(Console.WindowHeight - 5)), '/', ConsoleColor.Cyan);
                for (short x = 0; x < 4; x++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(start + 3 + x), (short)(Console.WindowHeight - 4)), '=', ConsoleColor.Cyan);
                }
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(start + 2), (short)(Console.WindowHeight - 4)), '<', ConsoleColor.Cyan);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(start + 7), (short)(Console.WindowHeight - 4)), '>', ConsoleColor.Cyan);

                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(start + 3), (short)(Console.WindowHeight - 3)), '/', ConsoleColor.Cyan);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(start + 4), (short)(Console.WindowHeight - 3)), '/', ConsoleColor.Cyan);
                break;
            }
        }
Пример #23
0
 public void Killed()
 {
     EngineFunctions.DrawToConsole(loc, ' ');
 }
Пример #24
0
 public void CheckEnemyCollision()
 {
     foreach (Enemy e in enemies)
     {
         //push player away from enemy
         if (e.loc.Equals(new EngineFunctions.COORD((short)(player.location.X - 1), player.location.Y)))
         {
             EngineFunctions.DrawToConsole(player.location, ' ');
             if (player.location.X + 4 >= Console.WindowWidth - 1)
             {
                 player.location = new EngineFunctions.COORD((short)(Console.WindowWidth - 2), player.location.Y);
             }
             else
             {
                 player.location = new EngineFunctions.COORD((short)(player.location.X + 4), player.location.Y);
             }
             player.TookDamage = true;
             player.CurHP     -= e.Damage;
         }
         else if (e.loc.Equals(new EngineFunctions.COORD((short)(player.location.X + 1), player.location.Y)))
         {
             EngineFunctions.DrawToConsole(player.location, ' ');
             if (player.location.X - 4 <= 0)
             {
                 player.location = new EngineFunctions.COORD((short)(1), player.location.Y);
             }
             else
             {
                 player.location = new EngineFunctions.COORD((short)(player.location.X - 4), player.location.Y);
             }
             player.TookDamage = true;
             player.CurHP     -= e.Damage;
         }
         else if (e.loc.Equals(new EngineFunctions.COORD(player.location.X, (short)(player.location.Y - 1))))
         {
             EngineFunctions.DrawToConsole(player.location, ' ');
             if (player.location.Y + 4 >= Console.WindowHeight - 11)
             {
                 player.location = new EngineFunctions.COORD(player.location.X, (short)(Console.WindowHeight - 12));
             }
             else
             {
                 player.location = new EngineFunctions.COORD(player.location.X, (short)(player.location.Y + 4));
             } player.TookDamage = true;
             player.CurHP       -= e.Damage;
         }
         else if (e.loc.Equals(new EngineFunctions.COORD(player.location.X, (short)(player.location.Y + 1))))
         {
             EngineFunctions.DrawToConsole(player.location, ' ');
             if (player.location.Y - 4 <= 0)
             {
                 player.location = new EngineFunctions.COORD(player.location.X, (short)(1));
             }
             else
             {
                 player.location = new EngineFunctions.COORD(player.location.X, (short)(player.location.Y - 4));
             }
             player.TookDamage = true;
             player.CurHP     -= e.Damage;
         }
     }
     if (player.CurHP <= 0)
     {
         gameOver = true;
     }
     player.PlaceCharacter();
 }
Пример #25
0
        private void DrawBomb()
        {
            if (player.IsBombPlaced && bombTimer.ElapsedMilliseconds >= 2500)
            {
                bombTimer.Stop();
                bombTimer.Reset();
                EngineFunctions.DrawToConsole(player.bombLoc, ' ', ConsoleColor.DarkBlue);
                player.IsBombPlaced = false;
                explosion           = true;
                bombTimer.Start();
            }
            if (player.IsBombPlaced && bombTimer.ElapsedMilliseconds <= 1500)
            {
                bombTimer.Start();
                EngineFunctions.DrawToConsole(player.bombLoc, '@', ConsoleColor.DarkBlue);
            }
            else if (player.IsBombPlaced && bombTimer.ElapsedMilliseconds > 1500)
            {
                EngineFunctions.DrawToConsole(player.bombLoc, '@', flashing ? ConsoleColor.Red : ConsoleColor.DarkBlue);
                if (DateTime.Now.TimeOfDay.Subtract(bombFlashTimer) > TimeSpan.FromMilliseconds(100))
                {
                    flashing       = !flashing;
                    bombFlashTimer = DateTime.Now.TimeOfDay;
                }
            }

            if (explosion && bombTimer.ElapsedMilliseconds <= 150)
            {
                if (player.bombLoc.X - 3 > 0)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(player.bombLoc.X - 3), (short)(player.bombLoc.Y)), '*', ConsoleColor.DarkBlue);
                }
                if (player.bombLoc.X - 2 > 0 && player.bombLoc.Y + 1 < Console.WindowHeight - 10)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(player.bombLoc.X - 2), (short)(player.bombLoc.Y + 1)), '*', ConsoleColor.DarkBlue);
                }
                if (player.bombLoc.Y + 3 < Console.WindowHeight - 10)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(player.bombLoc.X), (short)(player.bombLoc.Y + 3)), '*', ConsoleColor.DarkBlue);
                }
                if (player.bombLoc.X + 2 < Console.WindowWidth - 1 && player.bombLoc.Y + 1 < Console.WindowHeight - 10)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(player.bombLoc.X + 2), (short)(player.bombLoc.Y + 1)), '*', ConsoleColor.DarkBlue);
                }
                if (player.bombLoc.X + 3 < Console.WindowWidth - 1)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(player.bombLoc.X + 3), (short)(player.bombLoc.Y)), '*', ConsoleColor.DarkBlue);
                }
                if (player.bombLoc.X + 2 < Console.WindowWidth - 1 && player.bombLoc.Y - 1 > 0)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(player.bombLoc.X + 2), (short)(player.bombLoc.Y - 1)), '*', ConsoleColor.DarkBlue);
                }
                if (player.bombLoc.Y - 3 > 0)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(player.bombLoc.X), (short)(player.bombLoc.Y - 3)), '*', ConsoleColor.DarkBlue);
                }
                if (player.bombLoc.X - 2 > 0 && player.bombLoc.Y - 1 > 0)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(player.bombLoc.X - 2), (short)(player.bombLoc.Y - 1)), '*', ConsoleColor.DarkBlue);
                }
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD(player.bombLoc.X, player.bombLoc.Y), '*', ConsoleColor.DarkBlue);
            }
            else if (explosion && bombTimer.ElapsedMilliseconds >= 150)
            {
                bombTimer.Stop();
                bombTimer.Reset();
                explosion = false;
                hud.Bombs--;
                BombDamage();
            }
        }
Пример #26
0
        private void DrawMagicToScreen(bool erase)
        {
            switch (player.curFacing)
            {
            case FaceDirection.Up:
            default:
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(player.location.X - 2), (short)(player.location.Y - 4)),
                                              erase ? ' ' : '*', ConsoleColor.DarkCyan);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(player.location.X), (short)(player.location.Y - 4)),
                                              erase ? ' ' : '*', ConsoleColor.DarkCyan);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(player.location.X + 2), (short)(player.location.Y - 4)),
                                              erase ? ' ' : '*', ConsoleColor.DarkCyan);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(player.location.X - 1), (short)(player.location.Y - 2)),
                                              erase ? ' ' : '*', ConsoleColor.DarkCyan);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(player.location.X), (short)(player.location.Y - 2)),
                                              erase ? ' ' : '*', ConsoleColor.DarkCyan);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(player.location.X + 1), (short)(player.location.Y - 2)),
                                              erase ? ' ' : '*', ConsoleColor.DarkCyan);
                break;

            case FaceDirection.Down:
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(player.location.X - 2), (short)(player.location.Y + 4)),
                                              erase ? ' ' : '*', ConsoleColor.DarkCyan);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(player.location.X), (short)(player.location.Y + 4)),
                                              erase ? ' ' : '*', ConsoleColor.DarkCyan);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(player.location.X + 2), (short)(player.location.Y + 4)),
                                              erase ? ' ' : '*', ConsoleColor.DarkCyan);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(player.location.X - 1), (short)(player.location.Y + 2)),
                                              erase ? ' ' : '*', ConsoleColor.DarkCyan);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(player.location.X), (short)(player.location.Y + 2)),
                                              erase ? ' ' : '*', ConsoleColor.DarkCyan);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(player.location.X + 1), (short)(player.location.Y + 2)),
                                              erase ? ' ' : '*', ConsoleColor.DarkCyan);
                break;

            case FaceDirection.Left:
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(player.location.X - 4), (short)(player.location.Y - 2)),
                                              erase ? ' ' : '*', ConsoleColor.DarkCyan);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(player.location.X - 4), (short)(player.location.Y)),
                                              erase ? ' ' : '*', ConsoleColor.DarkCyan);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(player.location.X - 4), (short)(player.location.Y + 2)),
                                              erase ? ' ' : '*', ConsoleColor.DarkCyan);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(player.location.X - 2), (short)(player.location.Y - 1)),
                                              erase ? ' ' : '*', ConsoleColor.DarkCyan);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(player.location.X - 2), (short)(player.location.Y)),
                                              erase ? ' ' : '*', ConsoleColor.DarkCyan);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(player.location.X - 2), (short)(player.location.Y + 1)),
                                              erase ? ' ' : '*', ConsoleColor.DarkCyan);
                break;

            case FaceDirection.Right:
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(player.location.X + 4), (short)(player.location.Y - 2)),
                                              erase ? ' ' : '*', ConsoleColor.DarkCyan);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(player.location.X + 4), (short)(player.location.Y)),
                                              erase ? ' ' : '*', ConsoleColor.DarkCyan);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(player.location.X + 4), (short)(player.location.Y + 2)),
                                              erase ? ' ' : '*', ConsoleColor.DarkCyan);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(player.location.X + 2), (short)(player.location.Y - 1)),
                                              erase ? ' ' : '*', ConsoleColor.DarkCyan);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(player.location.X + 2), (short)(player.location.Y)),
                                              erase ? ' ' : '*', ConsoleColor.DarkCyan);
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(player.location.X + 2), (short)(player.location.Y + 1)),
                                              erase ? ' ' : '*', ConsoleColor.DarkCyan);
                break;
            }
        }
Пример #27
0
 private void SetSelection(List <MenuItem> items)
 {
     EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(items[selection].position.X - 4),
                                                             (short)items[selection].position.Y), "->", ConsoleColor.White);
 }
Пример #28
0
        public void DrawRoom()
        {
            short yBottom = (short)(Console.WindowHeight - 10);
            short xFar    = (short)(Console.WindowWidth - 1);

            #region Room Borders
            switch (RoomType)
            {
            case 0:
            {
                #region 4-way intersection
                for (short i = 0; i < Console.WindowWidth / 2 - 2; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(i, (short)(0)), '#', ConsoleColor.Gray);
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(i, yBottom), '#', ConsoleColor.Gray);
                }
                for (short i = (short)(Console.WindowWidth / 2 + 2); i < Console.WindowWidth; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(i, (short)(0)), '#', ConsoleColor.Gray);
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(i, yBottom), '#', ConsoleColor.Gray);
                }
                for (short i = 0; i < (Console.WindowHeight - 10) / 2 - 2; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(0), i), '#', ConsoleColor.Gray);
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(xFar, i), '#', ConsoleColor.Gray);
                }
                for (short i = (short)((Console.WindowHeight - 10) / 2 + 2); i < Console.WindowHeight - 10; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(0), i), '#', ConsoleColor.Gray);
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(xFar, i), '#', ConsoleColor.Gray);
                }
                #endregion
                break;
            }

            case 1:
            {
                #region T-up Intersection
                for (int i = 0; i < Console.WindowWidth / 2 - 2; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(i), 0), '#', ConsoleColor.Gray);
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(i), yBottom), '#', ConsoleColor.Gray);
                }
                for (int i = Console.WindowWidth / 2 + 2; i < Console.WindowWidth; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(i), 0), '#', ConsoleColor.Gray);
                }
                for (int i = 0; i < Console.WindowWidth; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(i), yBottom), '#', ConsoleColor.Gray);
                }
                for (int i = 0; i < (Console.WindowHeight - 10) / 2 - 2; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(0, (short)(i)), '#', ConsoleColor.Gray);
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(xFar, (short)(i)), '#', ConsoleColor.Gray);
                }
                for (int i = (Console.WindowHeight - 10) / 2 + 2; i < Console.WindowHeight - 10; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(0, (short)(i)), '#', ConsoleColor.Gray);
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(xFar, (short)(i)), '#', ConsoleColor.Gray);
                }
                #endregion
                break;
            }

            case 2:
            {
                #region T-down Intersection
                for (int i = 0; i < Console.WindowWidth / 2 - 2; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(i), yBottom), '#', ConsoleColor.Gray);
                }
                for (int i = Console.WindowWidth / 2 + 2; i < Console.WindowWidth; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(i), yBottom), '#', ConsoleColor.Gray);
                }
                for (int i = 0; i < Console.WindowWidth; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(i), 0), '#', ConsoleColor.Gray);
                }
                for (int i = 0; i < (Console.WindowHeight - 10) / 2 - 2; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(xFar, (short)(i)), '#', ConsoleColor.Gray);
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(0, (short)(i)), '#', ConsoleColor.Gray);
                }
                for (int i = (Console.WindowHeight - 10) / 2 + 2; i < Console.WindowHeight - 10; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(0, (short)(i)), '#', ConsoleColor.Gray);
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(xFar, (short)(i)), '#', ConsoleColor.Gray);
                }
                #endregion
                break;
            }

            case 3:
            {
                #region T-Left intersection
                for (int i = 0; i < Console.WindowWidth / 2 - 2; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(i), 0), '#', ConsoleColor.Gray);
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(i), yBottom), '#', ConsoleColor.Gray);
                }
                for (int i = Console.WindowWidth / 2 + 2; i < Console.WindowWidth; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(i), 0), '#', ConsoleColor.Gray);
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(i), yBottom), '#', ConsoleColor.Gray);
                }
                for (int i = 0; i < (Console.WindowHeight - 10) / 2 - 2; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(0, (short)(i)), '#', ConsoleColor.Gray);
                }
                for (int i = (Console.WindowHeight - 10) / 2 + 2; i < Console.WindowHeight - 10; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(0, (short)(i)), '#', ConsoleColor.Gray);
                }
                for (int i = 0; i < Console.WindowHeight - 10; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(xFar, (short)(i)), '#', ConsoleColor.Gray);
                }
                #endregion
                break;
            }

            case 4:
            {
                #region T-Right intersection
                for (int i = 0; i < Console.WindowWidth / 2 - 2; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(i), 0), '#', ConsoleColor.Gray);
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(i), yBottom), '#', ConsoleColor.Gray);
                }
                for (int i = Console.WindowWidth / 2 + 2; i < Console.WindowWidth; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(i), 0), '#', ConsoleColor.Gray);
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(i), yBottom), '#', ConsoleColor.Gray);
                }
                for (int i = 0; i < (Console.WindowHeight - 10) / 2 - 2; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(xFar, (short)(i)), '#', ConsoleColor.Gray);
                }
                for (int i = (Console.WindowHeight - 10) / 2 + 2; i < Console.WindowHeight - 10; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(xFar, (short)(i)), '#', ConsoleColor.Gray);
                }
                for (int i = 0; i < Console.WindowHeight - 10; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(0, (short)(i)), '#', ConsoleColor.Gray);
                }
                #endregion
                break;
            }

            case 5:
            {
                #region NW-corner
                for (int i = 0; i < Console.WindowWidth / 2 - 2; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(i), 0), '#', ConsoleColor.Gray);
                }
                for (int i = Console.WindowWidth / 2 + 2; i < Console.WindowWidth; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(i), 0), '#', ConsoleColor.Gray);;
                }
                for (int i = 0; i < (Console.WindowHeight - 10) / 2 - 2; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(0, (short)(i)), '#', ConsoleColor.Gray);
                }
                for (int i = (Console.WindowHeight - 10) / 2 + 2; i < Console.WindowHeight - 10; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(0, (short)(i)), '#', ConsoleColor.Gray);
                }
                for (int i = 0; i < Console.WindowWidth; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(i), yBottom), '#', ConsoleColor.Gray);
                }
                for (int i = 0; i < Console.WindowHeight - 10; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(xFar, (short)(i)), '#', ConsoleColor.Gray);
                }
                #endregion
                break;
            }

            case 6:
            {
                #region NE-corner
                for (int i = 0; i < Console.WindowWidth / 2 - 2; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(i), 0), '#', ConsoleColor.Gray);
                }
                for (int i = Console.WindowWidth / 2 + 2; i < Console.WindowWidth; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(i), 0), '#', ConsoleColor.Gray);
                }
                for (int i = 0; i < (Console.WindowHeight - 10) / 2 - 2; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(xFar, (short)(i)), '#', ConsoleColor.Gray);
                }
                for (int i = (Console.WindowHeight - 10) / 2 + 2; i < Console.WindowHeight - 10; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(xFar, (short)(i)), '#', ConsoleColor.Gray);
                }
                for (int i = 0; i < Console.WindowWidth; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(i), yBottom), '#', ConsoleColor.Gray);
                }
                for (int i = 0; i < Console.WindowHeight - 10; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(0, (short)(i)), '#', ConsoleColor.Gray);
                }
                #endregion
                break;
            }

            case 7:
            {
                #region SW-corner
                for (int i = 0; i < Console.WindowWidth / 2 - 2; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(i), yBottom), '#', ConsoleColor.Gray);
                }
                for (int i = Console.WindowWidth / 2 + 2; i < Console.WindowWidth; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(i), yBottom), '#', ConsoleColor.Gray);
                }
                for (int i = 0; i < (Console.WindowHeight - 10) / 2 - 2; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(0, (short)(i)), '#', ConsoleColor.Gray);
                }
                for (int i = (Console.WindowHeight - 10) / 2 + 2; i < Console.WindowHeight - 10; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(0, (short)(i)), '#', ConsoleColor.Gray);
                }
                for (int i = 0; i < Console.WindowWidth; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(i), 0), '#', ConsoleColor.Gray);
                }
                for (int i = 0; i < Console.WindowHeight - 10; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(xFar, (short)(i)), '#', ConsoleColor.Gray);
                }
                #endregion
                break;
            }

            case 8:
            {
                #region SE-corner
                for (int i = 0; i < Console.WindowWidth / 2 - 2; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(i), yBottom), '#', ConsoleColor.Gray);
                }
                for (int i = Console.WindowWidth / 2 + 2; i < Console.WindowWidth; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(i), yBottom), '#', ConsoleColor.Gray);
                }
                for (int i = 0; i < (Console.WindowHeight - 10) / 2 - 2; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(xFar, (short)(i)), '#', ConsoleColor.Gray);
                }
                for (int i = (Console.WindowHeight - 10) / 2 + 2; i < Console.WindowHeight - 10; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(xFar, (short)(i)), '#', ConsoleColor.Gray);
                }
                for (int i = 0; i < Console.WindowWidth; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(i), 0), '#', ConsoleColor.Gray);
                }
                for (int i = 0; i < Console.WindowHeight - 10; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(0, (short)(i)), '#', ConsoleColor.Gray);
                }
                #endregion
                break;
            }

            case 9:
            {
                #region E-dead End
                short stop = (short)(Console.WindowWidth - 3 * (Console.WindowWidth / 4));
                for (int i = stop; i < Console.WindowWidth; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(i), 0), '#', ConsoleColor.Gray);
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(i), yBottom), '#', ConsoleColor.Gray);
                }
                for (int i = 0; i <= Console.WindowHeight - 10; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(stop, (short)(i)), '#', ConsoleColor.Gray);
                }
                for (int i = 0; i < (Console.WindowHeight - 10) / 2 - 2; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(xFar, (short)(i)), '#', ConsoleColor.Gray);
                }
                for (int i = (Console.WindowHeight - 10) / 2 + 2; i < Console.WindowHeight - 10; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(xFar, (short)(i)), '#', ConsoleColor.Gray);
                }
                #endregion
                break;
            }

            case 10:
            {
                #region W-dead End
                short stop = (short)(Console.WindowWidth - (Console.WindowWidth / 4));
                for (int i = 0; i < stop; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(i), 0), '#', ConsoleColor.Gray);
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(i), yBottom), '#', ConsoleColor.Gray);
                }
                for (int i = 0; i <= Console.WindowHeight - 10; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(stop, (short)(i)), '#', ConsoleColor.Gray);
                }
                for (int i = 0; i < (Console.WindowHeight - 10) / 2 - 2; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(0, (short)(i)), '#', ConsoleColor.Gray);
                }
                for (int i = (Console.WindowHeight - 10) / 2 + 2; i < Console.WindowHeight - 10; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(0, (short)(i)), '#', ConsoleColor.Gray);
                }
                #endregion
                break;
            }

            case 11:
            {
                #region N-dead End
                short Wstop = (short)(Console.WindowWidth - 3 * (Console.WindowWidth / 4));
                short Estop = (short)(Console.WindowWidth - (Console.WindowWidth / 4));
                for (int i = Wstop; i < Console.WindowWidth / 2 - 2; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(i), 0), '#', ConsoleColor.Gray);
                }
                for (int i = Console.WindowWidth / 2 + 2; i < Estop; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(i), 0), '#', ConsoleColor.Gray);
                }
                for (int i = Wstop; i <= Estop; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(i), yBottom), '#', ConsoleColor.Gray);
                }
                for (int i = 0; i < Console.WindowHeight - 10; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(Wstop, (short)(i)), '#', ConsoleColor.Gray);
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(Estop, (short)(i)), '#', ConsoleColor.Gray);
                }
                #endregion
                break;
            }

            case 12:
            {
                #region S-dead End
                short Wstop = (short)(Console.WindowWidth - 3 * (Console.WindowWidth / 4));
                short Estop = (short)(Console.WindowWidth - (Console.WindowWidth / 4));
                for (int i = Wstop; i < Console.WindowWidth / 2 - 2; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(i), yBottom), '#', ConsoleColor.Gray);
                }
                for (int i = Console.WindowWidth / 2 + 2; i <= Estop; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(i), yBottom), '#', ConsoleColor.Gray);
                }
                for (int i = Wstop; i <= Estop; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(i), 0), '#', ConsoleColor.Gray);
                }
                for (int i = 0; i < Console.WindowHeight - 10; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(Wstop, (short)(i)), '#', ConsoleColor.Gray);
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(Estop, (short)(i)), '#', ConsoleColor.Gray);
                }
                #endregion
                break;
            }

            case 13:
            {
                #region H-Hall
                for (int i = 0; i < Console.WindowWidth; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(i), 0), '#', ConsoleColor.Gray);
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(i), yBottom), '#', ConsoleColor.Gray);
                }
                for (int i = 0; i < (Console.WindowHeight - 10) / 2 - 2; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(0, (short)(i)), '#', ConsoleColor.Gray);
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(xFar, (short)(i)), '#', ConsoleColor.Gray);
                }
                for (int i = (Console.WindowHeight - 10) / 2 + 2; i < Console.WindowHeight - 10; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(0, (short)(i)), '#', ConsoleColor.Gray);
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(xFar, (short)(i)), '#', ConsoleColor.Gray);
                }
                #endregion
                break;
            }

            case 14:
            {
                #region V-Hall
                short Wstop = (short)(Console.WindowWidth - 3 * (Console.WindowWidth / 4));
                short Estop = (short)(Console.WindowWidth - (Console.WindowWidth / 4));
                for (int i = Wstop; i < Console.WindowWidth / 2 - 2; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(i), 0), '#', ConsoleColor.Gray);
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(i), yBottom), '#', ConsoleColor.Gray);
                }
                for (int i = Console.WindowWidth / 2 + 2; i <= Estop; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(i), 0), '#', ConsoleColor.Gray);
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(i), yBottom), '#', ConsoleColor.Gray);
                }
                for (int i = 0; i < Console.WindowHeight - 10; i++)
                {
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(Wstop, (short)(i)), '#', ConsoleColor.Gray);
                    EngineFunctions.DrawToConsole(new EngineFunctions.COORD(Estop, (short)(i)), '#', ConsoleColor.Gray);
                }
                #endregion
                break;
            }
            }
            #endregion

            #region Draw Obstacles
            for (int index = 0; index < blocks.Count; index++)
            {
                for (short x = blocks[index].Left; x <= blocks[index].Right; x++)
                {
                    for (short y = blocks[index].Top; y <= blocks[index].Bottom; y++)
                    {
                        EngineFunctions.DrawToConsole(new EngineFunctions.COORD(x, y), Map.CurLevelInfo.Value, Map.CurLevelInfo.Key);
                    }
                }
            }
            #endregion

            #region Erase Sections
            for (int index = 0; index < destroyed.Count; index++)
            {
                EngineFunctions.DrawToConsole(new EngineFunctions.COORD(destroyed[index].X, destroyed[index].Y), ' ');
            }
            #endregion
        }
Пример #29
0
        public void EraseSword()
        {
            switch (Sword)
            {
            default:
            case SwordType.Wood:
                #region Starting Sword
                switch (curFacing)
                {
                case FaceDirection.Up:
                default:
                    for (int y = 1; y <= 4; y++)
                    {
                        EngineFunctions.DrawToConsole(new EngineFunctions.COORD(location.X, (short)(location.Y - y)), '|', ConsoleColor.DarkYellow);
                    }
                    break;

                case FaceDirection.Down:
                    for (int y = 1; y <= 4; y++)
                    {
                        EngineFunctions.DrawToConsole(new EngineFunctions.COORD(location.X, (short)(location.Y + y)), '|', ConsoleColor.DarkYellow);
                    }
                    break;

                case FaceDirection.Left:
                    for (int x = 1; x <= 4; x++)
                    {
                        EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(location.X - x), location.Y), '-', ConsoleColor.DarkYellow);
                    }
                    break;

                case FaceDirection.Right:
                    for (int x = 1; x <= 4; x++)
                    {
                        EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(location.X + x), location.Y), '-', ConsoleColor.DarkYellow);
                    }
                    break;
                }
                #endregion
                break;

            case SwordType.Short:
                #region Short Sword
                switch (curFacing)
                {
                case FaceDirection.Up:
                default:
                    for (int y = 1; y <= 4; y++)
                    {
                        EngineFunctions.DrawToConsole(new EngineFunctions.COORD(location.X, (short)(location.Y - y)), '|', ConsoleColor.DarkYellow);
                    }
                    break;

                case FaceDirection.Down:
                    for (int y = 1; y <= 4; y++)
                    {
                        EngineFunctions.DrawToConsole(new EngineFunctions.COORD(location.X, (short)(location.Y + y)), '|', ConsoleColor.DarkYellow);
                    }
                    break;

                case FaceDirection.Left:
                    for (int x = 1; x <= 4; x++)
                    {
                        EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(location.X - x), location.Y), '-', ConsoleColor.DarkYellow);
                    }
                    break;

                case FaceDirection.Right:
                    for (int x = 1; x <= 4; x++)
                    {
                        EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(location.X + x), location.Y), '-', ConsoleColor.DarkYellow);
                    }
                    break;
                }
                #endregion
                break;

            case SwordType.Great:
                #region Great Sword
                switch (curFacing)
                {
                case FaceDirection.Up:
                default:
                    for (int y = 1; y <= 5; y++)
                    {
                        EngineFunctions.DrawToConsole(new EngineFunctions.COORD(location.X, (short)(location.Y - y)), ' ', ConsoleColor.DarkYellow);
                    }
                    break;

                case FaceDirection.Down:
                    for (int y = 1; y <= 5; y++)
                    {
                        EngineFunctions.DrawToConsole(new EngineFunctions.COORD(location.X, (short)(location.Y + y)), ' ', ConsoleColor.DarkYellow);
                    }
                    break;

                case FaceDirection.Left:
                    for (int x = 1; x <= 5; x++)
                    {
                        EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(location.X - x), location.Y), ' ', ConsoleColor.DarkYellow);
                    }
                    break;

                case FaceDirection.Right:
                    for (int x = 1; x <= 5; x++)
                    {
                        EngineFunctions.DrawToConsole(new EngineFunctions.COORD((short)(location.X + x), location.Y), ' ', ConsoleColor.DarkYellow);
                    }
                    break;
                }
                #endregion
                break;
            }
            SwordHit = false;
        }
Пример #30
0
        public void Start()
        {
            while (true)
            {
                if (ResetGame)
                {
                    ResetGame = false;
                    startMenu = new Menu();
                }

                EngineFunctions.GetScreenBuffer();
                DrawScreen();
                EngineFunctions.DrawToBuffer();

                if (startMenu != null)
                {
                    int sel = startMenu.UpdateMenu();
                    switch (sel)
                    {
                    case 0:
                        startMenu = null;
                        LoadGame();
                        break;

                    case 1:
                        LoadSaveGame(startMenu.GetSelection());
                        startMenu = null;
                        break;

                    case 2:
                        startMenu = null;
                        Program.CloseGame();
                        break;
                    }
                }
                else
                {
                    if (gameOver)
                    {
                    }
                    else
                    {
                        if (player.ShouldSave)
                        {
                            SaveGame(player.SaveSlot);
                            player.ShouldSave = false;
                        }

                        if (inShop)
                        {
                            #region Shop Stuff
                            if (mapRoomTransition != FaceDirection.noDir)
                            {
                                player.PlaceInMapAfterShop(new EngineFunctions.COORD((short)(shop.location.X + 2), (short)(shop.location.Y + 4)));
                                inShop             = false;
                                shop.IsShopVisible = false;
                                shop.CanBuy        = true;
                            }
                            if (shop.CanBuy)
                            {
                                if (player.location.X == 31 && player.location.Y == 11)
                                {
                                    if (hud.Money >= shop.GetPrice(shop.itemsForSale[0]))
                                    {
                                        BuyItem(0);
                                        shop.CanBuy = false;
                                    }
                                }
                                else if (player.location.X == 41 && player.location.Y == 11)
                                {
                                    if (hud.Money >= shop.GetPrice(shop.itemsForSale[1]))
                                    {
                                        BuyItem(1);
                                        shop.CanBuy = false;
                                    }
                                }
                                else if (player.location.X == 51 && player.location.Y == 11)
                                {
                                    if (hud.Money >= shop.GetPrice(shop.itemsForSale[2]))
                                    {
                                        BuyItem(2);
                                        shop.CanBuy = false;
                                    }
                                }
                            }
                            #endregion
                        }
                        else
                        {
                            #region Items
                            int rIndex = -1;
                            for (int item = 0; item < itemsOnMap.Count; item++)
                            {
                                if (player.location.Equals(itemsOnMap[item].Location))
                                {
                                    if (itemsOnMap[item].IType == ItemType.Sphere)
                                    {
                                        hud.Spheres.Add(Map.CurLevelInfo.Key);
                                        player.CurHP = player.HP;
                                        //new level
                                        levelTransition   = true;
                                        endLevelParticles = new ParticleHandler(Map.CurLevelInfo.Value);
                                        endLevelParticles.SpawnParticles();
                                    }
                                    else
                                    {
                                        hud.AddItem(itemsOnMap[item].IType);
                                        if (itemsOnMap[item].IType == ItemType.Heart)
                                        {
                                            if (player.CurHP + 4 > player.HP)
                                            {
                                                player.CurHP = player.HP;
                                            }
                                            else
                                            {
                                                player.CurHP += 4;
                                            }
                                        }
                                    }
                                    rIndex = item;
                                    break;
                                }
                            }
                            if (rIndex >= 0)
                            {
                                itemsOnMap.RemoveAt(rIndex);
                                rIndex = -1;
                            }
                            #endregion

                            #region Enemies
                            enemies = m.getRoom().enemies;
                            foreach (Enemy enemy in enemies)
                            {
                                if (enemy.HP <= 0)
                                {
                                    if (enemy.enemytype == EType.Dragon)
                                    {
                                        itemsOnMap.Add(new Item(ItemType.Sphere, enemy.loc));
                                    }
                                    else if (enemies.Count == 1)
                                    {
                                        itemsOnMap.Add(new Item(ItemType.Key, enemy.loc));
                                    }
                                    else
                                    {
                                        int i = rand.Next(0, 100);
                                        if (i >= 20)
                                        {
                                            i = rand.Next(0, 100);
                                            if (i > 80)
                                            {
                                                itemsOnMap.Add(new Item(ItemType.Heart, enemy.loc));
                                            }
                                            else if (i > 35)
                                            {
                                                itemsOnMap.Add(new Item(ItemType.Crystal, enemy.loc));
                                            }
                                            else if (i > 30)
                                            {
                                                itemsOnMap.Add(new Item(ItemType.Key, enemy.loc));
                                            }
                                            else if (i > 10)
                                            {
                                                itemsOnMap.Add(new Item(ItemType.Magic, enemy.loc));
                                            }
                                            else
                                            {
                                                itemsOnMap.Add(new Item(ItemType.Bomb, enemy.loc));
                                            }
                                        }
                                    }
                                    enemy.Killed();
                                    enemies.Remove(enemy);
                                    break;
                                }
                            }
                            m.getRoom().enemies = enemies;
                            #endregion

                            #region Collision Checking
                            CheckEnemyCollision();
                            if (player.TookDamage)
                            {
                                player.TookDamage = false;
                                hud.ClearHealth(player.HP);
                                hud.DrawHealth(player.CurHP);
                            }
                            #endregion

                            #region Change Rooms
                            if (mapRoomTransition != FaceDirection.noDir)
                            {
                                m.MoveToNextRoom(mapRoomTransition);
                                player.PlaceInNextRoom(mapRoomTransition);
                                shop.ShowShop(player.Sword, player.HP);
                                itemsOnMap.Clear();

                                Room r = m.getRoom();
                                if (!r.IsExplored)
                                {
                                    r.IsExplored = true;
                                    RoomsExplored++;
                                }
                                if (RoomsExplored == m.GetRoomCount())
                                {
                                    r.enemies.Add(new Enemy(EType.Dragon));
                                }
                                m.SetRoom(r);
                            }
                            #endregion

                            #region Enter Shop
                            if (shop.IsShopVisible &&
                                player.location.Equals(new EngineFunctions.COORD((short)(shop.location.X + 2), (short)(shop.location.Y + 3))))
                            {
                                inShop = true;
                                player.PlaceInMapAfterShop(new EngineFunctions.COORD((short)(Console.WindowWidth / 2), 20));
                            }
                            #endregion

                            #region Unlock Door
                            if (player.UseKey)
                            {
                                if (hud.Keys > 0)
                                {
                                    hud.Keys--;
                                    player.UseKey = false;
                                    if (player.location.X == 1)
                                    {
                                        m.UnlockDoor(new Tuple <EngineFunctions.COORD, EngineFunctions.COORD>(
                                                         m.roomLocation,
                                                         new EngineFunctions.COORD((short)(m.roomLocation.X - 1), m.roomLocation.Y)));
                                    }
                                    else if (player.location.X == Console.WindowWidth - 2)
                                    {
                                        m.UnlockDoor(new Tuple <EngineFunctions.COORD, EngineFunctions.COORD>(
                                                         m.roomLocation,
                                                         new EngineFunctions.COORD((short)(m.roomLocation.X + 1), m.roomLocation.Y)));
                                    }
                                    else if (player.location.Y == 1)
                                    {
                                        m.UnlockDoor(new Tuple <EngineFunctions.COORD, EngineFunctions.COORD>(
                                                         m.roomLocation,
                                                         new EngineFunctions.COORD(m.roomLocation.X, (short)(m.roomLocation.Y - 1))));
                                    }
                                    else if (player.location.Y == Console.WindowHeight - 11)
                                    {
                                        m.UnlockDoor(new Tuple <EngineFunctions.COORD, EngineFunctions.COORD>(
                                                         m.roomLocation,
                                                         new EngineFunctions.COORD(m.roomLocation.X, (short)(m.roomLocation.Y + 1))));
                                    }
                                }
                            }
                            #endregion
                        }
                    }
                    player.UpdatePlayer(ref enemies, out mapRoomTransition, m.GetLockedDoors());
                }
            }
        }