Exemple #1
0
 public void HandleTest()
 {
     XmlParser p = new XmlParser();
     Form1 form = new Form1();
     string level = "level1";
     List<GameObject> objects = new List<GameObject>();
     p.Handle(objects, form, level);
     Assert.IsTrue(objects[0] is Player);
 }
Exemple #2
0
        public void Game_Init(string level)
        {
            //Initialize all components (ie. Player, Wall, Enemy,  etc.)
            properties_Gameover = false;
            properties_Pause = false;
            //Is replaced with information from the XML-file to make the enemies (loop)
            /*Right now this is a hardcoded placement*/

            game_objects = new List<GameObject>();
            // makes an XMLparser
            parser = new XmlParser();
            parser.Handle(game_objects, game_Form, level);

            //Add borders to the game
            int game_Width = game_Form.getWidthOfGame();
            int game_Height = game_Form.getHeightOfGame();
            game_objects.Add(new Border(0, 0, game_Width, 0, game_Form)); //Top
            game_objects.Add(new Border(0, game_Height, game_Width, 0, game_Form)); //Bottom
            game_objects.Add(new Border(0, 0, 0, game_Height, game_Form)); //Left
            game_objects.Add(new Border(game_Width, 0, 0, game_Height, game_Form)); //Right

            game_objects.Reverse();
        }