static void Main(string[] args) { Console.BackgroundColor = ConsoleColor.Black; Console.Title = "XYLIT v.a.1.0"; Game.CursorVisible = false; screen = new Screen(120, 60); screen.BackColor = ConsoleColor.Black; screen.ForeColor = ConsoleColor.White; screen.ResetScreen(); screen.AcceptChanges(); region = new Region(screen); string path = Environment.CurrentDirectory; Console.Write("Map config name: "); path += @"\Resources\" + Console.ReadLine(); region.LoadXmlConfig(path, false); region.LoadMap(); screen.AcceptChanges(); string text = "Legend:\n\n" + "To move your\n" + "Hero press the\n" + "Arrow Keys:\n" + "\n← ↑ → ↓\n\n" + "The action\n" + "button is\n" + "Spacebar ████" + "\n\n--------------\n\n" + "If you hit an\n" + "enemy you will\n" + "loose -1 HP\n\n" + "In order to \n" + "get HP back \n" + "collect those \n" + "hearts ♥\n\n" + "To kill an\n" + "enemy shoot at\n" + "him with your\n" + "pistol ╓\n" + "get +5 ammo\n" + "with these: ░"; Window infoWindow = new Window(screen, 101, 1, 18, 33, "LEGEND", text, ConsoleColor.White, ConsoleColor.DarkBlue, ConsoleColor.Yellow, ConsoleColor.White); Window status = new Window(screen, 101, 35, 18, 24, "STATUS", "Health: 15\n\nScore: 0\n\nBullets: 0\n\n\n\n\n\n\n\n\n\n\n\n\n--------------\n\nXylit by Marat", ConsoleColor.White, ConsoleColor.DarkBlue, ConsoleColor.Yellow, ConsoleColor.White); infoWindow.Show(); status.Show(); screen.AcceptChanges(); player = new MoveableObject(region, ' ', "Player", 2, 2, ConsoleColor.Green, ConsoleColor.Black, new string[] { "Fixed", "Enemy", "ClosedDoor" }); player.CollisionAction += new CollisionAction(player_CollisionAction); player.StandingTileAction += new StandingAction(player_StandingTileAction); bullet = new MoveableObject(region, '°', "bullet", player.Symbol.X, player.Symbol.Y, ConsoleColor.White, ConsoleColor.Black, new string[] { "Fixed", "Enemy", "ClosedDoor", "Barrel" }); bullet.Name = "MO_projectile" + (nonfixObject.Count - 1).ToString(); bullet.CollisionAction += new CollisionAction(projectile_CollisionAction); GameObject Temp = null; int numb = 0; for (int fx = 0; fx < region.Width; fx++) { for (int fy = 0; fy < region.Height; fy++) { Temp = region.Map[fx, fy]; if (Temp.ObjectType == "Enemy") { nonfixObject.Add(new MoveableObject( region, Temp.Symbol.Character, Temp.ObjectType, Temp.Symbol.X, Temp.Symbol.Y, Temp.Symbol.ForeColor, Temp.Symbol.BackColor, new string[] { "Player", "Enemy", "Fixed", "ClosedDoor", "Barrel" })); nonfixObject[nonfixObject.Count - 1].Name = "MO_Enemy" + (nonfixObject.Count - 1).ToString(); nonfixObject[nonfixObject.Count - 1].CollisionAction += new CollisionAction(Enemy_CollisionAction); } else if (Temp.ObjectType == "Barrel") { nonfixObject.Add(new MoveableObject(region, Temp.Symbol, "Barrel", new string[] { "Fixed", "ClosedDoor", "Enemy", "Player", "Barrel" })); region.Map[fx, fy] = new MoveableObject(region, Temp.Symbol, "Barrel", new string[] { "Fixed", "ClosedDoor", "Enemy", "Player", "Barrel" }); nonfixObject[nonfixObject.Count - 1].Name = "MO_Barrel" + numb++.ToString(); } else if (Temp.ObjectType == "Player") { player.Symbol = Temp.Symbol; } } } nonfixObject.Add(bullet); Thread keyPress = new Thread(KeyPressHandler); Thread loop = new Thread(loopMethod); region.Draw(); screen.AcceptChanges(); int width = 34, height = 5; int x = (region.Width / 2) - (width / 2), y = (region.Height / 2 - height / 2) - 5; Window waitingInfo = new Window(screen, x, y, width, height, "Game", "Press any key to start the game"); waitingInfo.Show(); Console.ReadKey(true); screen.RejectChanges(); screen.DrawArea(waitingInfo.X, waitingInfo.Y, waitingInfo.Width, waitingInfo.Height); screen.AcceptChanges(); loop.Start(); keyPress.Priority = ThreadPriority.Highest; keyPress.Start(); }