Beispiel #1
0
        /// <summary>
        /// Starts the game.
        /// </summary>
        private void StartGame()
        {
            countdown       = 105;
            GameOver        = false;
            MainMenu        = false;
            MainMenuOpening = false;
            LevelFinished   = false;
            Score           = 0;
            Life            = 3;
            Level           = 1;
            ScoreOnBoard    = 0;
            line            = new DXLine(400f, 707f);

            walls = new List <DXWall>();
            walls.Add(new DXWall(WallType.Vertical, 48f, 120f));
            walls.Add(new DXWall(WallType.Vertical, 896f, 120f));
            walls.Add(new DXWall(WallType.Horizontal, 48f, 104f));

            balls = new List <Ball>();
            Ball b = new Ball(0f, 0f);

            b.BrokeBox  += b_BrokeBox;
            b.TouchLine += b_TouchLine;
            b.SetDeterminateVelocity(15f, 0.25f, -Math.PI * 0.75);
            b.MaxVelocity = 30f;
            balls.Add(b);

            backGround = new BackgroundPage();

            boxes = DXLevels.OpenLevel(Level);
            colls = DXCollectables.OpenCollectables(Level);

            foreach (Collectables c in colls)
            {
                c.AddLine(line);
            }

            LoadAnimations();

            balls[0].AddRectangleOfLine(line);
            balls[0].AddRectanglesOfWalls(walls);
            balls[0].Boxes        = boxes;
            balls[0].Collectables = colls;
        }
Beispiel #2
0
        /// <summary>
        /// Nexts the level.
        /// </summary>
        private void NextLevel()
        {
            countdown       = 105;
            LevelFinished   = false;
            GameOver        = false;
            MainMenu        = false;
            MainMenuOpening = false;
            Level++;
            balls[0].AtStartPosition = true;
            balls[0].ToStartPosition();
            balls[0].SetDeterminateVelocity(15f + (0.5f * Level), 0.25f, -Math.PI * 0.75);
            balls[0].MaxVelocity = 30f + (0.5f * Level);
            boxes                 = DXLevels.OpenLevel(Level);
            colls                 = DXCollectables.OpenCollectables(Level);
            balls[0].Boxes        = boxes;
            balls[0].Collectables = colls;

            foreach (Collectables c in colls)
            {
                c.AddLine(line);
            }
        }