Пример #1
0
        public static void Main(string[] args)
        {
            //creating all necessary objects
            TitleScreen displayTitle = new TitleScreen(1);
            User        loadUser     = new User();
            Levels      buildLevel   = new Levels();
            Barriers    showBarrier  = new Barriers();

            //Console.SetCursorPosition(20, 5);

            //showBarrier.displayBigBarrier(20, 5);


            //calling all methods to run the game
            displayTitle.Display();
            Console.Clear();
            loadUser.MoveMent();
            buildLevel.BuildMap();      //runs the first level

            if (loadUser.hitBarrier == false)
            {
                buildLevel.BuildMap();
            }
        }
Пример #2
0
        private void UpdateGame(int xCord, int yCord)
        {

            int randPosition = randomNumber.Next(1, 70);        //random number for x position
            int hitCheck = randomNumber.Next(1, 70);


            int updateInterval = 450;


            if (specialLevel == false)
            {




                if (DateTime.Now.Subtract(gameTime) >
                   TimeSpan.FromMilliseconds(updateInterval))
                {


                    buildBarriers.displayHitBarrier(xCord, yCord);
                    hitBarrierPosition = hitCheck;
                    Console.SetCursorPosition(hitBarrierPosition, 20);



                    buildBarriers.displaySmallBarrier(xCord - 10, yCord);
                    smallBarrierPosition = randPosition;
                    Console.SetCursorPosition(smallBarrierPosition, 20);

                    buildBarriers.displaySmallBarrier(xCord - 10, yCord);
                    smallBarrierPosition = randPosition;
                    Console.SetCursorPosition(smallBarrierPosition, 20);

                    checkYCord = yCord;

                    buildBarriers.displayMediumBarrier(xCord, yCord);
                    mediumBarrierPosition = randPosition;
                    Console.SetCursorPosition(mediumBarrierPosition, 20);



                    buildBarriers.displayMediumBarrier(xCord, yCord);
                    mediumBarrierPosition = randPosition;
                    Console.SetCursorPosition(mediumBarrierPosition, 20);

                    buildBarriers.displayBigBarrier(xCord, yCord);
                    largeBarrierPosition = randPosition;
                    Console.SetCursorPosition(largeBarrierPosition, 20);

                    buildBarriers.displayBigBarrier(xCord, yCord);
                    largeBarrierPosition = randPosition;
                    Console.SetCursorPosition(largeBarrierPosition, 20);

                   

                    invalidated = true;
                    gameTime = DateTime.Now;


                    Console.SetCursorPosition(randPosition, 5);
                    score += 1;


                    if (score == 15) {

                        Console.WriteLine("Speed UP");
                        //newLevel.levelNumber = 3;
                        //System.Threading.Thread.Sleep(1000);
                        //Console.Clear();
                        //newLevel = new TitleScreen(3);
                        //callNewLevel.BuildMap();

                    }


                }





            }

            else if (specialLevel == true) {                    //this is only activated if the user hits the "s" key for special level


                Barriers changeBarrier = new Barriers();


                //Console.ReadKey();
                       

                Console.BackgroundColor = ConsoleColor.Blue;

                Console.ForegroundColor = ConsoleColor.White;

                if (DateTime.Now.Subtract(gameTime) >
                   TimeSpan.FromMilliseconds(updateInterval))
                {


                    buildBarriers.displayHitBarrier(xCord, yCord);
                    hitBarrierPosition = hitCheck;
                    Console.SetCursorPosition(hitBarrierPosition, 20);



                    buildBarriers.displaySmallBarrier(xCord - 10, yCord);
                    smallBarrierPosition = randPosition;
                    Console.SetCursorPosition(smallBarrierPosition, 20);

                    buildBarriers.displaySmallBarrier(xCord - 10, yCord);
                    smallBarrierPosition = randPosition;
                    Console.SetCursorPosition(smallBarrierPosition, 20);

                    checkYCord = yCord;

                    buildBarriers.displayMediumBarrier(xCord, yCord);
                    mediumBarrierPosition = randPosition;
                    Console.SetCursorPosition(mediumBarrierPosition, 20);



                    buildBarriers.displayMediumBarrier(xCord, yCord);
                    mediumBarrierPosition = randPosition;
                    Console.SetCursorPosition(mediumBarrierPosition, 20);

                    buildBarriers.displayBigBarrier(xCord, yCord);
                    largeBarrierPosition = randPosition;
                    Console.SetCursorPosition(largeBarrierPosition, 20);

                    buildBarriers.displayBigBarrier(xCord, yCord);
                    largeBarrierPosition = randPosition;
                    Console.SetCursorPosition(largeBarrierPosition, 20);



                    invalidated = true;
                    gameTime = DateTime.Now;


                    Console.SetCursorPosition(randPosition, 5);
                }




            }

        }//end of UpdateGame method