Пример #1
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            screenManager.AddScreen(new MainMenuScreen("Menu"), PlayerIndex.One);
            screenManager.Initialize();
            otherScreens = screenManager.GetScreens();

            startPlace = new Rectangle(400, 300, 28, 62);

            player1 = new Player(1, Color.Red);
            user1 = new UserInterface(player1);
            char1 = new Character(player1);
            char1.Place = new Rectangle(400, 300, 28, 62);

            player2 = new Player(2, Color.Blue);
            user2 = new UserInterface(player2);
            char2 = new Character(player2);
            char2.Place = new Rectangle(475, 300, 28, 62);

            player3 = new Player(3, Color.Green);
            user3 = new UserInterface(player3);
            char3 = new Character(player3);
            char3.Place = new Rectangle(550, 300, 28, 62);

            player4 = new Player(4, Color.Yellow);
            user4 = new UserInterface(player4);
            char4 = new Character(player4);
            char4.Place = new Rectangle(625, 300, 28, 62);

            characters.Add(char1);
            characters.Add(char2);
            characters.Add(char3);
            characters.Add(char4);

            // read the map
            ReadMap("map1.txt");
            base.Initialize();
        }